Changeset 852
- Timestamp:
- Nov 19, 2013, 9:47:43 PM (11 years ago)
- Location:
- trunk/xpressme_integration_kit/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/include/oninstall.php
r835 r852 47 47 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query,$wp_embed; 48 48 global $xoops_config; 49 49 50 50 define("WP_INSTALLING", true); 51 51 define('WP_FIRST_INSTALL', true); // For WPMU2.8 52 52 53 53 $site_url= XOOPS_URL."/modules/".$mydirname; 54 54 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 55 55 $path = $mydirpath . '/'; 56 56 $site_name = ucfirst($mydirname) . ' ' . _MI_XP2_NAME; 57 57 58 58 // permission and wordpress files check 59 59 require_once ($path . 'include/pre_check.php'); … … 66 66 return false; 67 67 } 68 68 69 69 // install WordPress 70 70 if (file_exists($path . 'wp-load.php')) { … … 77 77 make_db_current_silent(); 78 78 $ret[] = "The data base of wordpress was made by prefix $table_prefix.<br />"; 79 79 80 80 $option_desc = __('WordPress web address'); 81 $wpdb->query("INSERT INTO $wpdb->options (blog_id, option_name,option_value, autoload) VALUES ('0', 'siteurl','$site_url', 'yes')"); 81 $wpdb->query("INSERT INTO $wpdb->options (blog_id, option_name,option_value, autoload) VALUES ('0', 'siteurl','$site_url', 'yes')"); 82 82 $wpdb->query("INSERT INTO $wpdb->options (blog_id, option_name,option_value, autoload) VALUES ('0', 'home','$site_url', 'yes')"); 83 83 84 84 populate_options(); 85 85 populate_roles(); 86 86 87 87 // create XPressME table 88 88 $xp_prefix = preg_replace('/wordpress/','wp',$mydirname); … … 104 104 dbDelta($views_queries); 105 105 $ret[] = "$views_table table of XPressME was made.<br />"; 106 106 107 107 $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ; 108 108 $views_queries ="CREATE TABLE $d3forum_link ( … … 116 116 dbDelta($views_queries); 117 117 $ret[] = "$d3forum_link table of XPressME was made.<br />"; 118 118 119 119 $group_role = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_group_role' ; 120 120 $views_queries ="CREATE TABLE $group_role ( … … 130 130 dbDelta($views_queries); 131 131 $ret[] = "$group_role table of XPressME was made.<br />"; 132 132 133 133 $notify_reserve = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_notify_reserve' ; 134 134 $queries ="CREATE TABLE $notify_reserve ( … … 143 143 omit_user_id varchar(20) NOT NULL default '' , 144 144 KEY notify_reserve_id (notify_reserve_id) 145 ) TYPE=MyISAM";145 )$charset_collate;"; 146 146 dbDelta($queries); 147 147 $ret[] = "$notify_reserve table of XPressME was made.<br />"; … … 149 149 $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; 150 150 $wpdb->query($sql); 151 151 152 152 // make templates 153 153 include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 154 154 $t_mess = xpress_templates_make($mid,$mydirname); 155 155 156 156 // Admin User Data write 157 157 // Change uid field … … 160 160 $email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com'; 161 161 $pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):''; 162 162 163 163 add_filter('sanitize_user', "sanitize_user_multibyte" ,10,3); 164 164 165 165 if (!function_exists('username_exists')){ 166 166 require_once($mydirpath . '/wp-includes/registration-functions.php'); … … 177 177 $user->set_role('administrator'); 178 178 'User ' . $user_name . ' of the administrator was made.'; 179 // over write xoops md5 password 179 // over write xoops md5 password 180 180 $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 181 181 $wpdb->query($sql); 182 182 $ret[] = 'The password of XOOPS was copied.<br />'; 183 184 183 184 185 185 // Set Default data 186 // make WordPress Default data 186 // make WordPress Default data 187 187 if (function_exists('wp_install_defaults')){ 188 188 wp_install_defaults($user_id); … … 190 190 wp_install_old_defaults($user_id); 191 191 } 192 192 193 193 $ret[] = 'The first sample post & comment was written.<br />'; 194 194 195 195 // Rewrite Option for Xpress 196 196 $xoops_config_tbl = XOOPS_DB_PREFIX . '_config' ; 197 197 $sql = "SELECT conf_value FROM $xoops_config_tbl WHERE `conf_name` = 'default_TZ'"; 198 198 $xoops_default_TZ = $wpdb->get_var($sql); 199 update_option('gmt_offset', $xoops_default_TZ); 199 update_option('gmt_offset', $xoops_default_TZ); 200 200 201 201 if (WPLANG == 'ja_EUC') { … … 208 208 update_option("blog_charset", $setup_charset); 209 209 210 update_option('blogname', $site_name ); 210 update_option('blogname', $site_name ); 211 211 update_option('blogdescription', 'WordPress for XOOPS'); 212 212 update_option("admin_email", $GLOBALS["xoopsConfig"]['adminmail']); … … 217 217 update_option('default_pingback_flag', 0); 218 218 $ret[] = 'The initial data was written in the data base of wordpress.<br />'; 219 219 220 220 update_option("template", "xpress_default"); 221 221 update_option("stylesheet", "xpress_default"); … … 223 223 // update_option('uploads_use_yearmonth_folders', 1); 224 224 update_option('upload_path', 'wp-content/uploads'); 225 225 226 226 // activate the xpressme plugin 227 227 require_once dirname( __FILE__ ).'/xpress_active_plugin.php'; -
trunk/xpressme_integration_kit/include/onupdate.php
r835 r852 23 23 $db =& XoopsDatabaseFactory::getDatabaseConnection() ; 24 24 $mid = $module->getVar('mid') ; 25 25 26 26 27 27 … … 39 39 } 40 40 41 //Site_url and home of an optional table are repaired. 41 //Site_url and home of an optional table are repaired. 42 42 $site_url= XOOPS_URL."/modules/".$mydirname; 43 43 xpress_put_siteurl($mydirname,$site_url); … … 61 61 $t_mess = xpress_clean_templates_file($mydirname,$mod_version); 62 62 $msgs = array_merge($msgs,$t_mess); 63 63 64 64 $t_mess = xpress_templates_make($mid,$mydirname); 65 65 $msgs = array_merge($msgs,$t_mess); 66 66 67 // The activation processing of the XPressME plugin is omitted. 67 // The activation processing of the XPressME plugin is omitted. 68 68 // Because the XPressME plugin is done with wp-config in activation 69 69 … … 73 73 // $msgs[] = 'The xpressme plug-in was activated.'; 74 74 // } 75 75 76 76 return true ; 77 77 } … … 110 110 111 111 $sql = "SELECT option_value FROM $option_table WHERE option_name = '" . $option_name . "'"; 112 112 113 113 $result = $xoopsDB->query($sql, 0, 0); 114 114 if ($xoopsDB->getRowsNum($result) > 0){ … … 163 163 } 164 164 165 switch ( $xoops_block_check->get_op() ) 165 switch ( $xoops_block_check->get_op() ) 166 166 { 167 167 case "remove_block": … … 194 194 post_views bigint(20) unsigned NOT NULL default '0', 195 195 KEY post_id (post_id) 196 ) TYPE=MyISAM";196 ) ENGINE=MyISAM"; 197 197 $db->queryF( $queries ) ; 198 198 $msgs[] = "$views_table table of XPressME was made."; … … 203 203 $msgs[] = "$views_table ADD blog_id ."; 204 204 } 205 205 206 206 // The table is repaired. 207 207 $non_blogid_sql ="SELECT * FROM $views_table WHERE blog_id IS NULL OR blog_id < 1"; … … 222 222 } 223 223 } 224 224 225 225 $d3forum_link = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_d3forum_link' ; 226 226 if (! enhanced_table_check($mydirname,'d3forum_link')){ … … 232 232 blog_id bigint(20) unsigned NOT NULL default '0', 233 233 KEY post_id (post_id) 234 ) TYPE=MyISAM";234 )ENGINE=MyISAM"; 235 235 $db->queryF( $queries ) ; 236 236 $msgs[] = "$d3forum_link table of XPressME was made."; … … 265 265 login_all smallint(5) unsigned NOT NULL default '0' , 266 266 KEY groupid (groupid) 267 ) TYPE=MyISAM";267 )ENGINE=MyISAM"; 268 268 $db->queryF( $queries ) ; 269 269 $sql = "INSERT INTO $group_role (groupid, role) VALUES (1, 'administrator')"; … … 280 280 $db->queryF( $update_sql ) ; 281 281 } 282 282 283 283 if (! enhanced_table_check($mydirname,'notify_reserve')){ 284 284 $notify_reserve = XOOPS_DB_PREFIX . '_' . $xp_prefix .'_notify_reserve' ; … … 294 294 omit_user_id varchar(20) NOT NULL default '' , 295 295 KEY notify_reserve_id (notify_reserve_id) 296 ) TYPE=MyISAM";296 )ENGINE=MyISAM"; 297 297 $db->queryF( $queries ) ; 298 298 $msgs[] = "$notify_reserve table of XPressME was made."; … … 305 305 function enhanced_table_check($mydirname,$table_name){ 306 306 global $xoopsModule; 307 307 308 308 $xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection(); 309 309 $xpress_prefix = $xoopsDB->prefix(preg_replace('/wordpress/','wp',$mydirname) . '_');
Note: See TracChangeset
for help on using the changeset viewer.