} if ($uuid == '') { // Error getting UUID, display an error asking user to update manually $uuid_error = true; } // Hash password $password = password_hash(Input::get('password'), PASSWORD_BCRYPT, array("cost" => 13)); // Get current unix time $date = new DateTime(); $date = $date->getTimestamp(); try { // Create groups // Only create if they don't already exist for some reason $group_exists = $queries->getWhere("groups", array("id", "=", 1)); if (!count($group_exists)) { $queries->create("groups", array('id' => 1, 'name' => 'Standard', 'group_html' => '<span class="label label-success">Member</span>', 'group_html_lg' => '<span class="label label-success">Member</span>')); } $group_exists = $queries->getWhere("groups", array("id", "=", 2)); if (!count($group_exists)) { $queries->create("groups", array('id' => 2, 'name' => 'Admin', 'group_html' => '<span class="label label-danger">Admin</span>', 'group_html_lg' => '<span class="label label-danger">Admin</span>', 'mod_cp' => 1, 'admin_cp' => 1, 'staff' => 1)); } $group_exists = $queries->getWhere("groups", array("id", "=", 3)); if (!count($group_exists)) { $queries->create("groups", array('id' => 3, 'name' => 'Moderator', 'group_html' => '<span class="label label-info">Moderator</span>', 'group_html_lg' => '<span class="label label-info">Moderator</span>', 'mod_cp' => 1, 'staff' => 1)); } // Create admin account $user->create(array('username' => Input::get('username'), 'password' => $password, 'pass_method' => 'default', 'mcname' => $mcname, 'uuid' => $uuid, 'joined' => $date, 'group_id' => 2, 'email' => Input::get('email'), 'lastip' => "", 'active' => 1)); $login = $user->login(Input::get('username'), Input::get('password'), true); if ($login) { if (!isset($uuid_error)) { echo '<script>window.location.replace("./install.php?step=convert");</script>';
$group_id = 1; //The string "administrator" is not found in the users meta so they must be a member. # } /* * At this point the admin account has already been created with an ID of 1 so we must increment it. */ $id = $mysqli->query("SELECT * FROM 'users' ORDER BY 'id' DESC LIMIT 1"); $id; $user_id = $id['id']; echo $user_id; $user_id++; $group = null; // Get current unix time $date = new DateTime(); $date = $date->getTimestamp(); $queries->create("users", array("id" => $row['ID'] + 1, "username" => htmlspecialchars($row["user_login"]), "password" => htmlspecialchars($row["user_pass"]), "pass_method" => "wordpress", "mcname" => htmlspecialchars($row["display_name"]), "uuid" => "", "joined" => $date, "group_id" => $group_id, "email" => $row["user_email"], "lastip" => "", "active" => 1, "signature" => "", "reset_code" => "")); } $wordpress_users = null; $wordpress_date_registered = NULL; /* * Posts */ /* * We create a forum to put the posts in */ $queries->create("forums", array("id" => 1, "forum_title" => "Old Wordpress Posts", "forum_description" => "These are the old posts imported from WordPress. Please note, this is the parent forum which is required by NamelessMC, if you wish to delete this, please move the posts out of the forum below.", "last_post_date" => date('Y-m-d H:i:s'), "last_user_posted" => 1, "last_topic_posted" => date('Y-m-d H:i:s'), "parent" => 0, "forum_order" => 1)); $queries->create("forums", array("id" => 2, "forum_title" => "Old Wordpress Posts", "forum_description" => "These are the old posts imported from WordPress. Feel Free to rename this forum or move the posts accordingly.", "last_post_date" => date('Y-m-d H:i:s'), "last_user_posted" => 1, "last_topic_posted" => date('Y-m-d H:i:s'), "parent" => 1, "forum_order" => 2)); /* * Query the database */ $wordpress_posts = $mysqli->query("SELECT * FROM {$prefix}posts WHERE post_type='post'");
$custom_css = array(); // Get enabled addons $enabled_addon_pages = array(); $addons = $queries->getWhere('addons', array('enabled', '=', 1)); foreach ($addons as $addon) { // Require its initialisation file require 'addons/' . htmlspecialchars($addon->name) . '/initialisation.php'; $enabled_addon_pages[] = $addon->name; } /* * TEMPORARY - STAFF APPLICATION QUERY */ $staff_applications = $queries->getWhere('core_modules', array('name', '=', 'Staff_Applications')); // for upgrade purposes, can be deleted in the future if (!count($staff_applications)) { $queries->create('core_modules', array('name' => 'Staff_Applications', 'enabled' => 0)); $data = $queries->alterTable("groups", "staff_apps", "tinyint(1) NOT NULL DEFAULT '0'"); $data = $queries->alterTable("groups", "accept_staff_apps", "tinyint(1) NOT NULL DEFAULT '0'"); $data = $queries->createTable("staff_apps_comments", " `id` int(11) NOT NULL AUTO_INCREMENT, `aid` int(11) NOT NULL, `uid` int(11) NOT NULL, `time` int(11) NOT NULL, `content` mediumtext NOT NULL, PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); $data = $queries->createTable("staff_apps_questions", " `id` int(11) NOT NULL AUTO_INCREMENT, `type` int(11) NOT NULL, `name` varchar(16) NOT NULL, `question` varchar(256) NOT NULL, `options` text NOT NULL, PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); $data = $queries->createTable("staff_apps_replies", " `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL, `time` int(11) NOT NULL, `content` mediumtext NOT NULL, `status` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); } /* * TEMPORARY - MINECRAFT SERVER TABLE QUERY */ $mc_servers_col_exists = $queries->getWhere('settings', array('name', '=', 'query_update')); if (!count($mc_servers_col_exists)) { // Insert column for Minecraft query IP $data = $queries->alterTable("mc_servers", "query_ip", "varchar(64) NOT NULL"); // Insert column for Gravatar in users table $data = $queries->alterTable("users", "gravatar", "tinyint(1) NOT NULL DEFAULT '0'");
$webstore = $webstore[0]->value; if ($webstore == 'bc') { // Buycraft require 'integration/buycraft.php'; /* * PACKAGES SYNC */ // Categories first foreach ($bc_categories['payload'] as $item) { // Does it already exist in the database? $category_name = htmlspecialchars($item['name']); $category = $queries->getWhere('donation_categories', array('name', '=', $category_name)); if (!count($category)) { // No, it doesn't exist $category_id = $item['id']; $queries->create('donation_categories', array('name' => $category_name, 'cid' => $category_id, 'order' => 0)); } } // Delete any categories which don't exist on the web store anymore $categories = $queries->getWhere('donation_categories', array('id', '<>', 0)); foreach ($categories as $category) { if (!in_array_r($category->cid, $bc_categories['payload'])) { // It doesn't exist anymore $queries->delete('donation_categories', array('id', '=', $category->id)); } } // Packages next foreach ($bc_packages['payload'] as $item) { // Does it already exist in the database? $package_name = htmlspecialchars($item['name']); $package = $queries->getWhere('donation_packages', array('name', '=', $package_name));
$custom_css = array(); // Get enabled addons $enabled_addon_pages = array(); $addons = $queries->getWhere('addons', array('enabled', '=', 1)); foreach ($addons as $addon) { // Require its initialisation file require 'addons/' . htmlspecialchars($addon->name) . '/initialisation.php'; $enabled_addon_pages[] = $addon->name; } /* * TEMPORARY - STAFF APPLICATION QUERY */ $staff_applications = $queries->getWhere('core_modules', array('name', '=', 'Staff_Applications')); // for upgrade purposes, can be deleted in the future if (!count($staff_applications)) { $queries->create('core_modules', array('name' => 'Staff_Applications', 'enabled' => 0)); $data = $queries->alterTable("groups", "staff_apps", "tinyint(1) NOT NULL DEFAULT '0'"); $data = $queries->alterTable("groups", "accept_staff_apps", "tinyint(1) NOT NULL DEFAULT '0'"); $data = $queries->createTable("staff_apps_comments", " `id` int(11) NOT NULL AUTO_INCREMENT, `aid` int(11) NOT NULL, `uid` int(11) NOT NULL, `time` int(11) NOT NULL, `content` mediumtext NOT NULL, PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); $data = $queries->createTable("staff_apps_questions", " `id` int(11) NOT NULL AUTO_INCREMENT, `type` int(11) NOT NULL, `name` varchar(16) NOT NULL, `question` varchar(256) NOT NULL, `options` text NOT NULL, PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); $data = $queries->createTable("staff_apps_replies", " `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) NOT NULL, `time` int(11) NOT NULL, `content` mediumtext NOT NULL, `status` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)", "ENGINE=InnoDB DEFAULT CHARSET=latin1"); } // Get enabled modules $modules = $queries->getWhere('core_modules', array('enabled', '=', 1)); foreach ($modules as $module) { // Require its initialisation file require 'core/modules/' . htmlspecialchars($module->name) . '/initialisation.php'; } // Get site name from cache $c->setCache('sitenamecache'); $sitename = htmlspecialchars($c->retrieve('sitename'));
} else { if ($group["g_id"] == 4) { // member $group_id = 1; } else { if ($group["g_id"] == 3) { // guest, needs to be member $group_id = 1; } else { $group_id = $group["g_id"]; } } } } $group = null; $queries->create("users", array("id" => $row["id"], "username" => htmlspecialchars($row["username"]), "password" => htmlspecialchars($row["password"]), "pass_method" => "modernbb", "mcname" => htmlspecialchars($row["username"]), "uuid" => "", "joined" => date('U', $row["registered"]), "group_id" => $group_id, "email" => $row["email"], "lastip" => "", "active" => 1, "signature" => htmlspecialchars($row["signature"]), "reset_code" => "")); } } $modernbb_users = null; /* * Groups */ /* * Query the database */ $modernbb_groups = $mysqli->query("SELECT * FROM {$prefix}groups"); $modernbb_groups->data_seek(0); /* * Loop through the groups */ while ($row = $modernbb_groups->fetch_assoc()) {
if ($group == 3) { // admin $group_id = 2; } else { if ($group == 4) { // moderator $group_id = 3; } else { // member $group_id = 1; } } } } $group = null; $queries->create("users", array("username" => htmlspecialchars($row["username"]), "password" => '', "pass_method" => "default", "mcname" => htmlspecialchars($row["username"]), "uuid" => "", "joined" => $row["register_date"], "group_id" => $group_id, "email" => $row["email"], "isbanned" => $row["is_banned"], "lastip" => "", "active" => 1, "signature" => "", "reset_code" => "", "reputation" => $row["like_count"])); } } $xf_users = null; /* * Passwords */ $password = $mysqli->query("SELECT * FROM {$prefix}user_authenticate"); require 'core/includes/password.php'; while ($row = $password->fetch_assoc()) { $user_id = $row['user_id']; $user_id = $mysqli->query("SELECT * FROM {$prefix}user WHERE user_id = {$user_id}"); $user_id = $user_id->fetch_assoc(); $user_id = $user_id['username']; $user_id = $queries->getWhere('users', array('username', '=', $user_id)); $user_id = $user_id[0]->id;
$webstore = $webstore[0]->value; if ($webstore == 'bc') { // Buycraft require 'integration/buycraft.php'; /* * Categories and packages */ $packages = array(); $categories = array(); if (count($bc_categories)) { foreach ($bc_categories['categories'] as $item) { // Does it already exist in the database? $category = $queries->getWhere('donation_categories', array('cid', '=', htmlspecialchars($item['id']))); if (!count($category)) { // Input it now $queries->create('donation_categories', array('name' => htmlspecialchars($item['name']), 'cid' => $item['id'], 'order' => $item['order'])); } else { // Update category $queries->update('donation_categories', $category[0]->id, array('name' => htmlspecialchars($item['name']), 'cid' => $item['id'], '`order`' => $item['order'])); } // Packages if (count($item['packages'])) { foreach ($item['packages'] as $package) { // Does it already exist? $package_exists = $queries->getWhere('donation_packages', array('package_id', '=', $package['id'])); if (!count($package_exists)) { // Input it now $queries->create('donation_packages', array('name' => htmlspecialchars($package['name']), 'description' => 'No description available', 'cost' => $package['price'], 'package_id' => $package['id'], 'active' => 1, 'package_order' => $package['order'], 'category' => $item['id'], 'url' => 'none')); } else { // Update package // Only update description if no custom one is set