Changeset 210
- Timestamp:
- May 19, 2009, 7:39:43 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/oninstall.php
r183 r210 3 3 $mydirname = basename($mydirpath); 4 4 $lang = @$GLOBALS["xoopsConfig"]['language']; 5 global $wp_db_version ;5 global $wp_db_version,$wp_rewrite; 6 6 include_once $mydirpath .'/wp-includes/version.php' ; 7 7 … … 39 39 //xpress 40 40 global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles, $wp_query; 41 global $xoops_config; 42 41 43 define("WP_INSTALLING", true); 42 44 $site_url= XOOPS_URL."/modules/".$mydirname; 43 45 $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 44 46 $path = $mydirpath . '/'; 47 $site_name = ucfirst($mydirname) . ' ' . _MI_XP2_NAME; 48 49 // install WordPress 45 50 if (file_exists($path . 'wp-load.php')) { 46 51 require_once $path . 'wp-load.php'; … … 60 65 populate_roles(); 61 66 62 // Rewrite Option for Xpress 63 // update_option("blog_charset", wp_blog_charset()); 64 update_option('blogname', ucfirst($mydirname) . ' ' . _MI_XP2_NAME ); 65 update_option('blogdescription', 'WordPress for XOOPS'); 66 update_option("admin_email", $GLOBALS["xoopsConfig"]['adminmail']); 67 update_option("ping_sites", "http://rpc.pingomatic.com/\nhttp://ping.xoopsforge.com/"); 68 update_option("home", $site_url); 69 update_option("siteurl", $site_url); 70 update_option("what_to_show", "posts"); 71 update_option('default_pingback_flag', 0); 72 $ret[] = 'The initial data was written in the data base of wordpress.'; 73 74 update_option("template", "xpress_default"); 75 update_option("stylesheet", "xpress_default"); 76 $ret[] = 'The default theme of wordpress was set to xpress_default.'; 77 /* add new option for uploads */ 78 // update_option('uploads_use_yearmonth_folders', 1); 79 update_option('upload_path', 'wp-content/uploads'); 80 81 82 // Admin User Data write 83 // Change uid field 84 $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 85 $user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin'; 86 $email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com'; 87 $pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):''; 88 89 $user_id = username_exists($user_name); 90 if ( !$user_id ) { 91 $random_password = 'admin'; 92 $user_id = wp_create_user($user_name, $random_password, $email); 93 } else { 94 $random_password = __('User already exists. Password inherited.'); 95 } 96 97 $user = new WP_User($user_id); 98 $user->set_role('administrator'); 99 'User ' . $user_name . ' of the administrator was made.'; 100 // over write xoops md5 password 101 $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 102 $wpdb->query($sql); 103 $ret[] = 'The password of XOOPS was copied.'; 104 // Set Default data 105 wp_install_defaults($user_id); 106 $ret[] = 'The first sample post & comment was written.'; 107 // generate_page_uri_index(); 108 109 /* activate the XPressME plugin */ 110 $plugin_current = "xpressme/xpressme.php"; 111 update_option('active_plugins', array($plugin_current)); 112 include_once(dirname(__FILE__) . '/../wp-content/plugins/'.$plugin_current); 113 do_action('activate_'.$plugin_current); 114 $ret[] = 'The xpressme plug-in was activated.'; 115 116 // create views table 67 // create XPressME table 117 68 $xp_prefix = $mydirname; 118 69 if ($xp_prefix == 'wordpress'){ … … 164 115 $wpdb->query($sql); 165 116 166 117 // make templates 167 118 include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/xpress_templates_make.php' ; 168 119 $t_mess = xpress_templates_make($mid,$mydirname); 120 121 // Admin User Data write 122 // Change uid field 123 $wpdb->query("ALTER TABLE $wpdb->posts CHANGE `post_author` `post_author` mediumint(8) NOT NULL DEFAULT '0'"); 124 $user_name = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("uname"):'admin'; 125 $email = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("email"):'foo@exsample.com'; 126 $pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):''; 127 128 $user_id = username_exists($user_name); 129 if ( !$user_id ) { 130 $random_password = 'admin'; 131 if (!$xoops_config->is_wpmu){ 132 $user_id = wp_create_user($user_name, $random_password, $email); 133 } else { 134 $user_id = wpmu_create_user($user_name, $random_password, $email); 135 } 136 } else { 137 $random_password = __('User already exists. Password inherited.'); 138 } 139 140 $user = new WP_User($user_id); 141 $user->set_role('administrator'); 142 'User ' . $user_name . ' of the administrator was made.'; 143 // over write xoops md5 password 144 $sql = "UPDATE $wpdb->users SET user_pass ='$pass_md5' WHERE ID = $user_id"; 145 $wpdb->query($sql); 146 $ret[] = 'The password of XOOPS was copied.'; 147 148 149 // Set Default data 150 if (!$xoops_config->is_wpmu){ // for WordPress 151 // make WordPress Default data 152 wp_install_defaults($user_id); 153 $ret[] = 'The first sample post & comment was written.'; 154 155 // Rewrite Option for Xpress 156 // update_option("blog_charset", wp_blog_charset()); 157 update_option('blogname', $site_name ); 158 update_option('blogdescription', 'WordPress for XOOPS'); 159 update_option("admin_email", $GLOBALS["xoopsConfig"]['adminmail']); 160 update_option("ping_sites", "http://rpc.pingomatic.com/\nhttp://ping.xoopsforge.com/"); 161 update_option("home", $site_url); 162 update_option("siteurl", $site_url); 163 update_option("what_to_show", "posts"); 164 update_option('default_pingback_flag', 0); 165 $ret[] = 'The initial data was written in the data base of wordpress.'; 166 167 update_option("template", "xpress_default"); 168 update_option("stylesheet", "xpress_default"); 169 $ret[] = 'The default theme of wordpress was set to xpress_default.'; 170 // update_option('uploads_use_yearmonth_folders', 1); 171 update_option('upload_path', 'wp-content/uploads'); 172 173 } else { // for WordPress MU 174 global $base,$current_site, $dirs, $wpmu_version; 175 176 $base = $xoops_config->mu_path_current_site; 177 $domain = $xoops_config->mu_domain_current_site; 178 $admin_email = $GLOBALS["xoopsConfig"]['adminmail']; 179 $admin_user_name = $user_name; 180 $admin_user_id = $user_id; 181 include_once($mydirpath . '/include/xpress_mu_function.php'); 182 183 do_htaccess( $xoops_config->module_path . '/htaccess.dist', $xoops_config->module_path . '/.htaccess', $base, ''); 184 xpress_mu_install_defaults($domain,$base,$site_name,$admin_user_id,$admin_user_name,$admin_email); 185 } 186 187 // activate the xpressme plugin 188 require_once dirname( __FILE__ ).'/xpress_active_plugin.php'; 189 if (xpress_pulugin_activation('xpressme/xpressme.php')){ 190 $ret[] = 'The xpressme plug-in was activated.'; 191 } 192 169 193 $ret = array_merge($ret,$t_mess); 170 194 -
trunk/wp-config.php
r207 r210 51 51 define('LOGGED_IN_KEY', 'put your unique phrase here'); 52 52 define('NONCE_KEY', 'put your unique phrase here'); 53 54 if ($xoops_config->is_wpmu){ //for WordPressMU 55 define('VHOST', 'no'); 56 $base = $xoops_config->mu_path_current_site; 57 define('DOMAIN_CURRENT_SITE', $xoops_config->mu_domain_current_site ); 58 define('PATH_CURRENT_SITE', $xoops_config->mu_path_current_site ); 59 define('SITE_ID_CURRENT_SITE', 1); 60 define('BLOGID_CURRENT_SITE', '1' ); 61 62 define('AUTH_SALT', 'put your unique phrase here'); 63 define('LOGGED_IN_SALT', 'put your unique phrase here'); 64 define('SECURE_AUTH_SALT', 'put your unique phrase here'); 65 } 53 66 54 67 /**
Note: See TracChangeset
for help on using the changeset viewer.