Changeset 102 for trunk/include/oninstall.php
- Timestamp:
- Mar 8, 2009, 6:06:59 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/oninstall.php
r96 r102 164 164 $wpdb->query($sql); 165 165 166 // TEMPLATES 167 $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 168 $tpl_path = dirname( dirname( __FILE__ ) ).'/templates/source' ; 169 if( $handler = @opendir( $tpl_path . '/' ) ) { 170 while( ( $file = readdir( $handler ) ) !== false ) { 171 if( substr( $file , 0 , 1 ) == '.' ) continue ; 172 $file_path = $tpl_path . '/' . $file ; 173 if( is_file( $file_path ) ) { 174 $mtime = intval( @filemtime( $file_path ) ) ; 175 $tplfile =& $tplfile_handler->create() ; 176 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 177 $tplfile->setVar( 'tpl_refid' , $mid ) ; 178 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 179 $tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ; 180 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 181 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 182 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 183 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 184 $tplfile->setVar( 'tpl_type' , 'block' ) ; 185 if( ! $tplfile_handler->insert( $tplfile ) ) { 186 $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />'; 187 } else { 188 $tplid = $tplfile->getVar( 'tpl_id' ) ; 189 $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; 190 // generate compiled file 191 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 192 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 193 if( ! xoops_template_touch( $tplid ) ) { 194 $ret[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span><br />'; 195 } else { 196 $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span><br />'; 197 } 198 } 199 } 200 } 201 closedir( $handler ) ; 202 } 203 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 204 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 205 xoops_template_clear_module_cache( $mid ) ; 166 // make templates 167 include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 168 $t_mess = xpress_templates_make($mid,$mydirname); 169 $ret = array_merge($ret,$t_mess); 206 170 207 171 return true ;
Note: See TracChangeset
for help on using the changeset viewer.