- Timestamp:
- Mar 8, 2009, 6:06:59 PM (16 years ago)
- Location:
- trunk/include
- Files:
-
- 1 added
- 2 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 ; -
trunk/include/onupdate.php
r96 r102 133 133 } 134 134 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); 177 139 178 140 return true ;
Note: See TracChangeset
for help on using the changeset viewer.