Changeset 89 for trunk/include
- Timestamp:
- Feb 5, 2009, 5:48:55 PM (16 years ago)
- Location:
- trunk/include
- Files:
-
- 3 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 ; -
trunk/include/onupdate.php
r81 r89 132 132 } 133 133 134 clean_template($mydirname,$xpress_version); 135 136 // update templates 137 // include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates.php' ; 138 // $msgs = xpress_update_templates($mid,$mydirname); 134 // TEMPLATES (all templates have been already removed by modulesadmin) 135 136 $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; 137 $tpl_path = dirname( dirname( __FILE__ ) ).'/templates/source' ; 138 if( $handler = @opendir( $tpl_path . '/' ) ) { 139 while( ( $file = readdir( $handler ) ) !== false ) { 140 if( substr( $file , 0 , 1 ) == '.' ) continue ; 141 $file_path = $tpl_path . '/' . $file ; 142 if( is_file( $file_path ) ) { 143 $mtime = intval( @filemtime( $file_path ) ) ; 144 $tplfile =& $tplfile_handler->create() ; 145 $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; 146 $tplfile->setVar( 'tpl_refid' , $mid ) ; 147 $tplfile->setVar( 'tpl_tplset' , 'default' ) ; 148 $tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ; 149 $tplfile->setVar( 'tpl_desc' , '' , true ) ; 150 $tplfile->setVar( 'tpl_module' , $mydirname ) ; 151 $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; 152 $tplfile->setVar( 'tpl_lastimported' , 0 ) ; 153 $tplfile->setVar( 'tpl_type' , 'block' ) ; 154 if( ! $tplfile_handler->insert( $tplfile ) ) { 155 $msgs[] = '<span style="color:#flockf0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>'; 156 } else { 157 $tplid = $tplfile->getVar( 'tpl_id' ) ; 158 $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)'; 159 // generate compiled file 160 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 161 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 162 if( ! xoops_template_touch( $tplid ) ) { 163 $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>'; 164 } else { 165 $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> compiled.</span>'; 166 } 167 } 168 } 169 } 170 closedir( $handler ) ; 171 } 172 include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; 173 include_once XOOPS_ROOT_PATH.'/class/template.php' ; 174 xoops_template_clear_module_cache( $mid ) ; 175 139 176 140 177 return true ; … … 176 213 endif; 177 214 178 if( ! function_exists( 'clean_template' ) ) :179 function clean_template($mydirname,$xpress_ver){180 global $xoopsModule;181 182 $var = floatval($xpress_ver);183 switch ($var){184 case ($var >= 0.62):185 $temp_file = "'". $mydirname . "_home.html','" . $mydirname. "_index.html','" . $mydirname . "_search.html','" . $mydirname . "_single.html'";186 break;187 case ($var >= 0.60):188 $temp_file = "'xpress_header.html','xpress_home.html','xpress_index.html','xpress_search.html','xpress_sidebar.html'";189 break;190 default:191 $temp_file = 'all';192 }193 194 if ($temp_file != 'all'){195 $xoopsDB =& Database::getInstance();196 $db_tplfile = $xoopsDB->prefix('tplfile');197 $db_tplsource = $xoopsDB->prefix('tplsource');198 199 $sql = "SELECT * FROM $db_tplfile WHERE tpl_module = '$mydirname' AND NOT tpl_file IN($temp_file)";200 $res = $xoopsDB->query($sql, 0, 0);201 if ($res === false){202 return false;203 } else {204 $del_array = '';205 $i=0;206 while($row = $xoopsDB->fetchArray($res)){207 if (!empty($del_array))208 $del_array .= ',';209 $del_array .= $row['tpl_id'];210 }211 if(!empty($del_array)){212 $del_tplfile = "DELETE FROM $db_tplfile WHERE tpl_id IN ($del_array)";213 $result = $xoopsDB->query($del_tplfile, 0, 0);214 $del_tplsource = "DELETE FROM $del_tplsource WHERE tpl_id IN ($del_array)";215 $result = $xoopsDB->query($del_tplfile, 0, 0);216 }217 }218 }219 }220 endif;221 215 222 216 if( ! function_exists( 'enhanced_table_check' ) ) : -
trunk/include/xpress_block_render.php
r49 r89 104 104 $inc_theme_file_name = $call_theme_function_name . '_theme.php'; 105 105 $cache_title = str_replace(".php", "", $block_function_name); 106 $blockID =get_block_id($mydirname,$func_file,$options); 107 106 $blockID =get_block_id($mydirname,$func_file,$options); 107 108 108 if (!is_null($wpdb)){ 109 109 xpress_block_css_set($mydirname); … … 119 119 $block = $xml['block']; 120 120 } 121 return $block; 121 122 $templates_file = 'db:'.$mydirname. '_' . str_replace(".php", ".html", $block_function_name); 123 $tpl =& new XoopsTpl() ; 124 $tpl->assign( 'block' , $block ) ; 125 $ret['content'] = $tpl->fetch( $templates_file ) ; 126 return $ret ; 122 127 } 123 128
Note: See TracChangeset
for help on using the changeset viewer.