XPressME Integration Kit

Trac


Ignore:
Timestamp:
Mar 8, 2009, 6:06:59 PM (15 years ago)
Author:
toemon
Message:

#64 アップデート毎にテンプレートファイルが重複するバグ修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/onupdate.php

    r96 r102  
    133133        } 
    134134         
    135         // TEMPLATES (all templates have been already removed by modulesadmin) 
    136  
    137         $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 
    138         $tpl_path = dirname( dirname( __FILE__ ) ).'/templates/source' ; 
    139         if( $handler = @opendir( $tpl_path . '/' ) ) { 
    140                 while( ( $file = readdir( $handler ) ) !== false ) { 
    141                         if( substr( $file , 0 , 1 ) == '.' ) continue ; 
    142                         $file_path = $tpl_path . '/' . $file ; 
    143                         if( is_file( $file_path ) ) { 
    144                                 $mtime = intval( @filemtime( $file_path ) ) ; 
    145                                 $tplfile =& $tplfile_handler->create() ; 
    146                                 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 
    147                                 $tplfile->setVar( 'tpl_refid' , $mid ) ; 
    148                                 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 
    149                                 $tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ; 
    150                                 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 
    151                                 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 
    152                                 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 
    153                                 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 
    154                                 $tplfile->setVar( 'tpl_type' , 'block' ) ; 
    155                                 if( ! $tplfile_handler->insert( $tplfile ) ) { 
    156                                         $msgs[] = '<span style="color:#flockf0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>'; 
    157                                 } else { 
    158                                         $tplid = $tplfile->getVar( 'tpl_id' ) ; 
    159                                         $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)'; 
    160                                         // generate compiled file 
    161                                         include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 
    162                                         include_once XOOPS_ROOT_PATH.'/class/template.php' ; 
    163                                         if( ! xoops_template_touch( $tplid ) ) { 
    164                                                 $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>'; 
    165                                         } else { 
    166                                                 $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span>'; 
    167                                         } 
    168                                 } 
    169                         } 
    170                 } 
    171                 closedir( $handler ) ; 
    172         } 
    173         include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 
    174         include_once XOOPS_ROOT_PATH.'/class/template.php' ; 
    175         xoops_template_clear_module_cache( $mid ) ; 
    176  
     135        // make templates 
     136        include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 
     137        $t_mess = xpress_templates_make($mid,$mydirname); 
     138        $ret = array_merge($ret,$t_mess); 
    177139         
    178140        return true ; 
Note: See TracChangeset for help on using the changeset viewer.