Changeset 89 for trunk/include/oninstall.php
- Timestamp:
- Feb 5, 2009, 5:48:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/oninstall.php
r81 r89 87 87 // require_once($mydirpath . '/include/user_sync.php'); 88 88 $sync_messg = ''; 89 xpress_user_sync($ID,$sync_messg); //this function in XPressME plugin89 // user_sync_to_wordpress($ID,$sync_messg); //this function in XPressME plugin 90 90 91 91 // Set Default data … … 138 138 $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; 139 139 $wpdb->query($sql); 140 // make templates 141 // include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates.php' ; 142 // $ret = xpress_install_templates($mid,$mydirname); 140 141 // TEMPLATES 142 $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 143 $tpl_path = dirname( dirname( __FILE__ ) ).'/templates/source' ; 144 if( $handler = @opendir( $tpl_path . '/' ) ) { 145 while( ( $file = readdir( $handler ) ) !== false ) { 146 if( substr( $file , 0 , 1 ) == '.' ) continue ; 147 $file_path = $tpl_path . '/' . $file ; 148 if( is_file( $file_path ) ) { 149 $mtime = intval( @filemtime( $file_path ) ) ; 150 $tplfile =& $tplfile_handler->create() ; 151 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 152 $tplfile->setVar( 'tpl_refid' , $mid ) ; 153 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 154 $tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ; 155 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 156 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 157 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 158 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 159 $tplfile->setVar( 'tpl_type' , 'block' ) ; 160 if( ! $tplfile_handler->insert( $tplfile ) ) { 161 $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />'; 162 } else { 163 $tplid = $tplfile->getVar( 'tpl_id' ) ; 164 $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; 165 // generate compiled file 166 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 167 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 168 if( ! xoops_template_touch( $tplid ) ) { 169 $ret[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span><br />'; 170 } else { 171 $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span><br />'; 172 } 173 } 174 } 175 } 176 closedir( $handler ) ; 177 } 178 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 179 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 180 xoops_template_clear_module_cache( $mid ) ; 143 181 144 182 return true ;
Note: See TracChangeset
for help on using the changeset viewer.