function install_done() { global $output, $db, $mybb, $errors, $cache, $lang; if (empty($mybb->input['adminuser'])) { $errors[] = $lang->admin_step_error_nouser; } if (empty($mybb->input['adminpass'])) { $errors[] = $lang->admin_step_error_nopassword; } if ($mybb->input['adminpass'] != $mybb->input['adminpass2']) { $errors[] = $lang->admin_step_error_nomatch; } if (empty($mybb->input['adminemail'])) { $errors[] = $lang->admin_step_error_noemail; } if (is_array($errors)) { create_admin_user(); } require MYBB_ROOT . 'inc/config.php'; $db = db_connection($config); require MYBB_ROOT . 'inc/settings.php'; $mybb->settings =& $settings; ob_start(); $output->print_header($lang->finish_setup, 'finish'); echo $lang->done_step_usergroupsinserted; // Insert all of our user groups from the XML file $usergroup_settings = file_get_contents(INSTALL_ROOT . 'resources/usergroups.xml'); $parser = new XMLParser($usergroup_settings); $parser->collapse_dups = 0; $tree = $parser->get_tree(); $admin_gid = ''; $group_count = 0; foreach ($tree['usergroups'][0]['usergroup'] as $usergroup) { // usergroup[cancp][0][value] $new_group = array(); foreach ($usergroup as $key => $value) { if (!is_array($value)) { continue; } $new_group[$key] = $db->escape_string($value[0]['value']); } $db->insert_query("usergroups", $new_group, false); // If this group can access the admin CP and we haven't established the admin group - set it (just in case we ever change IDs) if ($new_group['cancp'] == 1 && !$admin_gid) { $admin_gid = $usergroup['gid'][0]['value']; } $group_count++; } // Restart usergroup sequence with correct # of groups if ($config['database']['type'] == "pgsql") { $db->query("SELECT setval('{$config['database']['table_prefix']}usergroups_gid_seq', (SELECT max(gid) FROM {$config['database']['table_prefix']}usergroups));"); } echo $lang->done . '</p>'; echo $lang->done_step_admincreated; $now = TIME_NOW; $salt = random_str(); $loginkey = generate_loginkey(); $saltedpw = md5(md5($salt) . md5($mybb->input['adminpass'])); $newuser = array('username' => $db->escape_string($mybb->input['adminuser']), 'password' => $saltedpw, 'salt' => $salt, 'loginkey' => $loginkey, 'email' => $db->escape_string($mybb->input['adminemail']), 'usergroup' => $admin_gid, 'regdate' => $now, 'lastactive' => $now, 'lastvisit' => $now, 'website' => '', 'icq' => '', 'aim' => '', 'yahoo' => '', 'msn' => '', 'birthday' => '', 'signature' => '', 'allownotices' => 1, 'hideemail' => 0, 'subscriptionmethod' => '0', 'receivepms' => 1, 'pmnotice' => 1, 'pmnotify' => 1, 'showsigs' => 1, 'showavatars' => 1, 'showquickreply' => 1, 'invisible' => 0, 'style' => '0', 'timezone' => 0, 'dst' => 0, 'threadmode' => '', 'daysprune' => 0, 'regip' => $db->escape_string(get_ip()), 'longregip' => intval(my_ip2long(get_ip())), 'language' => '', 'showcodebuttons' => 1, 'tpp' => 0, 'ppp' => 0, 'referrer' => 0, 'buddylist' => '', 'ignorelist' => '', 'pmfolders' => '', 'notepad' => '', 'showredirect' => 1, 'usernotes' => ''); $db->insert_query('users', $newuser); echo $lang->done . '</p>'; echo $lang->done_step_adminoptions; $adminoptions = file_get_contents(INSTALL_ROOT . 'resources/adminoptions.xml'); $parser = new XMLParser($adminoptions); $parser->collapse_dups = 0; $tree = $parser->get_tree(); $insertmodule = array(); $db->delete_query("adminoptions"); // Insert all the admin permissions foreach ($tree['adminoptions'][0]['user'] as $users) { $uid = $users['attributes']['uid']; foreach ($users['permissions'][0]['module'] as $module) { foreach ($module['permission'] as $permission) { $insertmodule[$module['attributes']['name']][$permission['attributes']['name']] = $permission['value']; } } $defaultviews = array(); foreach ($users['defaultviews'][0]['view'] as $view) { $defaultviews[$view['attributes']['type']] = $view['value']; } $adminoptiondata = array('uid' => intval($uid), 'cpstyle' => '', 'notes' => '', 'permissions' => $db->escape_string(serialize($insertmodule)), 'defaultviews' => $db->escape_string(serialize($defaultviews))); $insertmodule = array(); $db->insert_query('adminoptions', $adminoptiondata); } echo $lang->done . '</p>'; // Automatic Login my_unsetcookie("sid"); my_unsetcookie("mybbuser"); my_setcookie('mybbuser', $uid . '_' . $loginkey, null, true); ob_end_flush(); // Make fulltext columns if supported if ($db->supports_fulltext('threads')) { $db->create_fulltext_index('threads', 'subject'); } if ($db->supports_fulltext_boolean('posts')) { $db->create_fulltext_index('posts', 'message'); } echo $lang->done_step_cachebuilding; require_once MYBB_ROOT . 'inc/class_datacache.php'; $cache = new datacache(); $cache->update_version(); $cache->update_attachtypes(); $cache->update_smilies(); $cache->update_badwords(); $cache->update_usergroups(); $cache->update_forumpermissions(); $cache->update_stats(); $cache->update_forums(); $cache->update_moderators(); $cache->update_usertitles(); $cache->update_reportedposts(); $cache->update_mycode(); $cache->update_posticons(); $cache->update_update_check(); $cache->update_tasks(); $cache->update_spiders(); $cache->update_bannedips(); $cache->update_banned(); $cache->update_bannedemails(); $cache->update_birthdays(); $cache->update_groupleaders(); $cache->update_threadprefixes(); $cache->update_forumsdisplay(); $cache->update("plugins", array()); $cache->update("internal_settings", array('encryption_key' => random_str(32))); $version_history = array(); $dh = opendir(INSTALL_ROOT . "resources"); while (($file = readdir($dh)) !== false) { if (preg_match("#upgrade([0-9]+).php\$#i", $file, $match)) { $version_history[$match[1]] = $match[1]; } } sort($version_history, SORT_NUMERIC); $cache->update("version_history", $version_history); echo $lang->done . '</p>'; echo $lang->done_step_success; $written = 0; if (is_writable('./')) { $lock = @fopen('./lock', 'w'); $written = @fwrite($lock, '1'); @fclose($lock); if ($written) { echo $lang->done_step_locked; } } if (!$written) { echo $lang->done_step_dirdelete; } echo $lang->done_whats_next; $output->print_footer(''); }
} else { if (!$result->result && empty($mybb->input['email']) && !empty($result->email)) { $mybb->input['email'] = $result->email; $mybb->input['email2'] = $result->email; } } } $usergroup = 5; if ($verify_result && $mybb->settings['regtype'] != "admin") { $usergroup = isset($mybb->settings['tapatalk_register_group']) ? $mybb->settings['tapatalk_register_group'] : 2; } if (!$verify_result) { tt_is_spam(); } // Set the data for the new user. $user = array("username" => $mybb->input['username'], "password" => $mybb->input['password'], "password2" => $mybb->input['password2'], "email" => $mybb->input['email'], "email2" => $mybb->input['email2'], "usergroup" => $usergroup, "referrer" => $mybb->input['referrername'], "timezone" => $mybb->settings['timezoneoffset'], "language" => $mybb->input['language'], "profile_fields" => $mybb->input['profile_fields'], "regip" => $session->ipaddress, "longregip" => my_ip2long($session->ipaddress), "coppa_user" => intval($mybb->cookies['coppauser'])); $user['options'] = array("allownotices" => $mybb->input['allownotices'], "hideemail" => $mybb->input['hideemail'], "subscriptionmethod" => $mybb->input['subscriptionmethod'], "receivepms" => $mybb->input['receivepms'], "pmnotice" => $mybb->input['pmnotice'], "emailpmnotify" => $mybb->input['emailpmnotify'], "invisible" => $mybb->input['invisible'], "dstcorrection" => $mybb->input['dstcorrection']); $userhandler->set_data($user); $errors = ""; if (!$userhandler->validate_user()) { $errors = $userhandler->get_friendly_errors(); } if (is_array($errors)) { error($errors[0]); } else { $user_info = $userhandler->insert_user(); if ($mybb->settings['regtype'] == "randompass") { $emailsubject = $lang->sprintf($lang->emailsubject_randompassword, $mybb->settings['bbname']); switch ($mybb->settings['username_method']) { case 0: $emailmessage = $lang->sprintf($lang->email_randompassword, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);
function upgrade12_dbchanges7() { global $db, $output; $output->print_header("Konwersja adresów IP użytkowników"); if (!$_POST['ipspage']) { $ipp = 5000; } else { $ipp = $_POST['ipspage']; } if ($_POST['ipstart']) { $startat = $_POST['ipstart']; $upper = $startat + $ipp; $lower = $startat; } else { $startat = 0; $upper = $ipp; $lower = 1; } $query = $db->simple_select("users", "COUNT(uid) AS ipcount"); $cnt = $db->fetch_array($query); if ($upper > $cnt['ipcount']) { $upper = $cnt['ipcount']; } $contents .= "<p>Konwersja adresu IP z {$lower} na {$upper} (Łącznie: {$cnt['ipcount']})</p>"; $ipaddress = false; $update_array = array(); $query = $db->simple_select("users", "regip, lastip, longlastip, longregip, uid", "", array('limit_start' => $lower, 'limit' => $ipp)); while ($user = $db->fetch_array($query)) { // Have we already converted this ip? if (!$user['longregip']) { $update_array['longregip'] = intval(my_ip2long($user['regip'])); } if (!$user['longlastip']) { $update_array['longlastip'] = intval(my_ip2long($user['lastip'])); } if (!empty($update_array)) { $db->update_query("users", $update_array, "uid = '{$user['uid']}'"); } $update_array = array(); $ipaddress = true; } $remaining = $upper - $cnt['ipcount']; if ($remaining && $ipaddress) { $nextact = "12_dbchanges7"; $startat = $startat + $ipp; $contents .= "<p><input type=\"hidden\" name=\"ipspage\" value=\"{$ipp}\" /><input type=\"hidden\" name=\"ipstart\" value=\"{$startat}\" />Zakończono. Naciśnij przycisk Dalej, aby przejść do konwersji innego typu adresów IP.</p>"; } else { $nextact = "12_dbchanges8"; $contents .= "<p>Zakończono</p><p>Wszystkie adresy IP użytkowników zostały skonwertowane do nowego formatu. Naciśnij przycisk Dalej, aby kontynuować.</p>"; } $output->print_contents($contents); global $footer_extra; $footer_extra = "<script type=\"text/javascript\">window.onload = function() { var button = \$\$('.submit_button'); if(button[0]) { button[0].value = 'Automatyczne przekierowanie...'; button[0].disabled = true; button[0].style.color = '#aaa'; button[0].style.borderColor = '#aaa'; document.forms[0].submit(); }}</script>"; $output->print_footer($nextact); }
function upgrade12_dbchanges7() { global $db, $output; $output->print_header("User IP Conversion"); if (!$_POST['ipspage']) { $ipp = 5000; } else { $ipp = $_POST['ipspage']; } if ($_POST['ipstart']) { $startat = $_POST['ipstart']; $upper = $startat + $ipp; $lower = $startat; } else { $startat = 0; $upper = $ipp; $lower = 1; } $query = $db->simple_select("users", "COUNT(uid) AS ipcount"); $cnt = $db->fetch_array($query); if ($upper > $cnt['ipcount']) { $upper = $cnt['ipcount']; } $contents .= "<p>Converting ip {$lower} to {$upper} ({$cnt['ipcount']} Total)</p>"; $ipaddress = false; $update_array = array(); $query = $db->simple_select("users", "regip, lastip, longlastip, longregip, uid", "", array('limit_start' => $lower, 'limit' => $ipp)); while ($user = $db->fetch_array($query)) { // Have we already converted this ip? if (!$user['longregip']) { $update_array['longregip'] = intval(my_ip2long($user['regip'])); } if (!$user['longlastip']) { $update_array['longlastip'] = intval(my_ip2long($user['lastip'])); } if (!empty($update_array)) { $db->update_query("users", $update_array, "uid = '{$user['uid']}'"); } $update_array = array(); $ipaddress = true; } $remaining = $upper - $cnt['ipcount']; if ($remaining && $ipaddress) { $nextact = "12_dbchanges7"; $startat = $startat + $ipp; $contents .= "<p><input type=\"hidden\" name=\"ipspage\" value=\"{$ipp}\" /><input type=\"hidden\" name=\"ipstart\" value=\"{$startat}\" />Done. Click Next to move on to the next set of user ips.</p>"; } else { $nextact = "12_dbchanges8"; $contents .= "<p>Done</p><p>All user ips have been converted to the new ip format. Click next to continue.</p>"; } $output->print_contents($contents); global $footer_extra; $footer_extra = "<script type=\"text/javascript\">window.onload = function() { var button = \$\$('.submit_button'); if(button[0]) { button[0].value = 'Automatically Redirecting...'; button[0].disabled = true; button[0].style.color = '#aaa'; button[0].style.borderColor = '#aaa'; document.forms[0].submit(); }}</script>"; $output->print_footer($nextact); }
/** * Fetch an IPv4 long formatted range for searching IPv4 IP addresses. * * @param string The IP address to convert to a range based LONG * @rturn mixed If a full IP address is provided, the ip2long equivalent, otherwise an array of the upper & lower extremities of the IP */ function fetch_longipv4_range($ip) { $ip_bits = explode(".", $ip); $ip_string1 = $ip_string2 = ""; if ($ip == "*") { return array(my_ip2long('128.0.0.0'), my_ip2long('127.255.255.255')); } if (strpos($ip, ".*") === false) { $ip = str_replace("*", "", $ip); if (count($ip_bits) == 4) { return my_ip2long($ip); } else { return array(my_ip2long($ip . ".0"), my_ip2long($ip . ".255")); } } else { $sep = ""; foreach ($ip_bits as $piece) { if ($piece == "*") { $ip_string1 .= $sep . "0"; $ip_string2 .= $sep . "255"; } else { $ip_string1 .= $sep . $piece; $ip_string2 .= $sep . $piece; } $sep = "."; } return array(my_ip2long($ip_string1), my_ip2long($ip_string2)); } }
/** * Inserts a user into the database. */ function insert_user() { global $db, $cache, $plugins; // Yes, validating is required. if (!$this->get_validated()) { die("The user needs to be validated before inserting it into the DB."); } if (count($this->get_errors()) > 0) { die("The user is not valid."); } $user =& $this->data; $this->user_insert_data = array("username" => $db->escape_string($user['username']), "password" => $user['saltedpw'], "salt" => $user['salt'], "loginkey" => $user['loginkey'], "email" => $db->escape_string($user['email']), "postnum" => intval($user['postnum']), "avatar" => $db->escape_string($user['avatar']), "avatartype" => $db->escape_string($user['avatartype']), "usergroup" => intval($user['usergroup']), "additionalgroups" => $db->escape_string($user['additionalgroups']), "displaygroup" => intval($user['displaygroup']), "usertitle" => $db->escape_string(htmlspecialchars_uni($user['usertitle'])), "regdate" => intval($user['regdate']), "lastactive" => intval($user['lastactive']), "lastvisit" => intval($user['lastvisit']), "website" => $db->escape_string(htmlspecialchars_uni($user['website'])), "icq" => intval($user['icq']), "aim" => $db->escape_string(htmlspecialchars_uni($user['aim'])), "yahoo" => $db->escape_string(htmlspecialchars_uni($user['yahoo'])), "msn" => $db->escape_string(htmlspecialchars_uni($user['msn'])), "birthday" => $user['bday'], "signature" => $db->escape_string($user['signature']), "allownotices" => $user['options']['allownotices'], "hideemail" => $user['options']['hideemail'], "subscriptionmethod" => intval($user['options']['subscriptionmethod']), "receivepms" => $user['options']['receivepms'], "receivefrombuddy" => $user['options']['receivefrombuddy'], "pmnotice" => $user['options']['pmnotice'], "pmnotify" => $user['options']['pmnotify'], "showsigs" => $user['options']['showsigs'], "showavatars" => $user['options']['showavatars'], "showquickreply" => $user['options']['showquickreply'], "showredirect" => $user['options']['showredirect'], "tpp" => intval($user['options']['tpp']), "ppp" => intval($user['options']['ppp']), "invisible" => $user['options']['invisible'], "style" => intval($user['style']), "timezone" => $db->escape_string($user['timezone']), "dstcorrection" => intval($user['options']['dstcorrection']), "threadmode" => $user['options']['threadmode'], "daysprune" => intval($user['options']['daysprune']), "dateformat" => $db->escape_string($user['dateformat']), "timeformat" => $db->escape_string($user['timeformat']), "regip" => $db->escape_string($user['regip']), "longregip" => intval(my_ip2long($user['regip'])), "language" => $db->escape_string($user['language']), "showcodebuttons" => $user['options']['showcodebuttons'], "away" => $user['away']['away'], "awaydate" => $user['away']['date'], "returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']), "notepad" => $db->escape_string($user['notepad']), "referrer" => intval($user['referrer_uid']), "referrals" => 0, "buddylist" => '', "ignorelist" => '', "pmfolders" => '', "notepad" => '', "warningpoints" => 0, "moderateposts" => 0, "moderationtime" => 0, "suspendposting" => 0, "suspensiontime" => 0, "coppauser" => intval($user['coppa_user']), "classicpostbit" => $user['options']['classicpostbit'], "usernotes" => ''); if ($user['options']['dstcorrection'] == 1) { $this->user_insert_data['dst'] = 1; } else { if ($user['options']['dstcorrection'] == 0) { $this->user_insert_data['dst'] = 0; } } $plugins->run_hooks("datahandler_user_insert", $this); $this->uid = $db->insert_query("users", $this->user_insert_data); $user['user_fields']['ufid'] = $this->uid; $query = $db->simple_select("profilefields", "fid"); while ($profile_field = $db->fetch_array($query)) { if (array_key_exists("fid{$profile_field['fid']}", $user['user_fields'])) { continue; } $user['user_fields']["fid{$profile_field['fid']}"] = ''; } $db->insert_query("userfields", $user['user_fields'], false); if ($this->user_insert_data['referrer'] != 0) { $db->write_query("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "users\n\t\t\t\tSET referrals=referrals+1\n\t\t\t\tWHERE uid='{$this->user_insert_data['referrer']}'\n\t\t\t"); } // Update forum stats update_stats(array('numusers' => '+1')); return array("uid" => $this->uid, "username" => $user['username'], "loginkey" => $user['loginkey'], "email" => $user['email'], "password" => $user['password'], "usergroup" => $user['usergroup']); }
/** * Registers an user with Facebook data */ public function register($user) { if (!$user) { return false; } global $mybb, $session, $plugins, $lang; require_once MYBB_ROOT . "inc/datahandlers/user.php"; $userhandler = new UserDataHandler("insert"); $plength = 8; if ($mybb->settings['minpasswordlength']) { $plength = (int) $mybb->settings['minpasswordlength']; } $password = random_str($plength); $new_user = array("username" => $user['name'], "password" => $password, "password2" => $password, "email" => $user['email'], "email2" => $user['email'], "usergroup" => (int) $mybb->settings['myfbconnect_usergroup'], "regip" => $session->ipaddress, "longregip" => my_ip2long($session->ipaddress), "options" => array("hideemail" => 1)); /* Registration might fail for custom profile fields required at registration... workaround = IN_ADMINCP defined. Placed straight before the registration process to avoid conflicts with third party plugins messying around with templates (I'm looking at you, PHPTPL) */ define("IN_ADMINCP", 1); $userhandler->set_data($new_user); if ($userhandler->validate_user()) { $user_info = $userhandler->insert_user(); $plugins->run_hooks("member_do_register_end"); // Deliver a welcome PM if ($mybb->settings['myfbconnect_passwordpm']) { require_once MYBB_ROOT . "inc/datahandlers/pm.php"; $pmhandler = new PMDataHandler(); $pmhandler->admin_override = true; // Make sure admins haven't done something bad $fromid = (int) $mybb->settings['myfbconnect_passwordpm_fromid']; if (!$mybb->settings['myfbconnect_passwordpm_fromid'] or !user_exists($mybb->settings['myfbconnect_passwordpm_fromid'])) { $fromid = 0; } $message = $mybb->settings['myfbconnect_passwordpm_message']; $subject = $mybb->settings['myfbconnect_passwordpm_subject']; $thingsToReplace = array("{user}" => $user_info['username'], "{password}" => $password); // Replace what needs to be replaced foreach ($thingsToReplace as $find => $replace) { $message = str_replace($find, $replace, $message); } $pm = array("subject" => $subject, "message" => $message, "fromid" => $fromid, "toid" => array($user_info['uid'])); // Some defaults :) $pm['options'] = array("signature" => 1); $pmhandler->set_data($pm); // Now let the PM handler do all the hard work if ($pmhandler->validate_pm()) { $pmhandler->insert_pm(); } else { error($lang->sprintf($lang->myfbconnect_error_report, $pmhandler->get_friendly_errors())); } } // Post a message on the user's wall if ($mybb->settings['myfbconnect_postonwall']) { $this->post_on_wall($mybb->settings['myfbconnect_postonwall_message']); } // Finally return our new user data return $user_info; } else { return array('error' => $userhandler->get_friendly_errors()); } return true; }
function upgrade17_dbchanges7() { global $db, $output; $output->print_header("User IP Repair Conversion"); if (!$_POST['ipspage']) { $ipp = 5000; } else { $ipp = (int) $_POST['ipspage']; } if ($_POST['ipstart']) { $startat = (int) $_POST['ipstart']; $upper = $startat + $ipp; $lower = $startat; } else { $startat = 0; $upper = $ipp; $lower = 1; } $query = $db->simple_select("users", "COUNT(uid) AS ipcount"); $cnt = $db->fetch_array($query); if ($upper > $cnt['ipcount']) { $upper = $cnt['ipcount']; } $contents .= "<p>Repairing ip {$lower} to {$upper} ({$cnt['ipcount']} Total)</p>"; $ipaddress = false; $update_array = array(); $query = $db->simple_select("users", "regip, lastip, uid", "", array('limit_start' => $lower, 'limit' => $ipp)); while ($user = $db->fetch_array($query)) { $update_array = array('longregip' => (int) my_ip2long($user['regip']), 'longlastip' => (int) my_ip2long($user['lastip'])); $db->update_query("users", $update_array, "uid = '{$user['uid']}'"); $update_array = array(); $ipaddress = true; } $remaining = $upper - $cnt['ipcount']; if ($remaining && $ipaddress) { $nextact = "17_dbchanges7"; $startat = $startat + $ipp; $contents .= "<p><input type=\"hidden\" name=\"ipspage\" value=\"{$ipp}\" /><input type=\"hidden\" name=\"ipstart\" value=\"{$startat}\" />Done. Click Next to move on to the next set of user ips.</p>"; } else { $nextact = "17_redoconfig"; $contents .= "<p>Done</p><p>All user ips have been successfully repaired. Click next to continue.</p>"; } $output->print_contents($contents); global $footer_extra; $footer_extra = "<script type=\"text/javascript\">\$(document).ready(function() { var button = \$('.submit_button'); if(button) { button.val('Automatically Redirecting...'); button.prop('disabled', true); button.css('color', '#aaa'); button.css('border-color', '#aaa'); document.forms[0].submit(); } });</script>"; $output->print_footer($nextact); }
function sign_in_func() { global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $mobiquo_config, $user, $register; // Load global language phrases $lang->load("member"); $parser = new postParser(); $token = trim($_POST['token']); $code = trim($_POST['code']); $username = $mybb->input['username']; $password = $mybb->input['password']; $post_email = $mybb->input['email']; $status = ''; if (!empty($token) && !empty($code)) { $result = tt_register_verify($token, $code); if ($result->result && !empty($result->email)) { $email = $result->email; if (!empty($post_email) && $post_email != $email) { $status = 3; } else { if ($user = tt_get_user_by_email($email)) { if (!empty($username) && strtolower($username) != strtolower($user['username'])) { $status = 3; } else { $register = 0; return tt_login_success(); } } else { if (!empty($username) && !empty($email)) { $profile = $result->profile; if ($mybb->settings['disableregs'] == 1) { error($lang->registrations_disabled); } // Set up user handler. require_once MYBB_ROOT . "inc/datahandlers/user.php"; $userhandler = new UserDataHandler("insert"); $birthday_arr = explode('-', $profile->birthday); $bday = array("day" => $birthday_arr[2], "month" => $birthday_arr[1], "year" => $birthday_arr[0]); $user_field = array('fid3' => ucfirst($profile->gender), 'fid1' => $profile->location, 'fid2' => $profile->description); if ($mybb->settings['regtype'] == "admin") { $usergroup = 5; } else { $usergroup = isset($mybb->settings['tapatalk_register_group']) ? $mybb->settings['tapatalk_register_group'] : 2; } // Set the data for the new user. $user = array("username" => $mybb->input['username'], "password" => $mybb->input['password'], "password2" => $mybb->input['password'], "email" => $email, "email2" => $email, "usergroup" => $usergroup, "referrer" => '', "timezone" => $mybb->settings['timezoneoffset'], "language" => '', "regip" => $session->ipaddress, "longregip" => my_ip2long($session->ipaddress), "coppa_user" => 0, "birthday" => $bday, "website" => $profile->link, "user_fields" => $user_field, "signature" => $profile->signature, "option" => array(), "regdate" => TIME_NOW, "lastvisit" => TIME_NOW); if (!empty($profile->avatar_url)) { $updated_avatar = tt_update_avatar_url($profile->avatar_url); } $userhandler->set_data($user); $userhandler->verify_birthday(); $userhandler->verify_options(); if ($userhandler->verify_username_exists()) { $status = 1; } else { if (!$userhandler->verify_password() || !$userhandler->verify_username()) { $errors = $userhandler->get_friendly_errors(); error($errors[0]); } else { $userhandler->set_validated(true); $user = $userhandler->insert_user(); if (!empty($updated_avatar)) { $db->update_query("users", $updated_avatar, "uid='" . $user['uid'] . "'"); } $register = 1; return tt_login_success(); } } } else { $status = 2; } } } } else { if (!$result->result) { if (!empty($result->result_text)) { error($result->result_text); } else { error("Tapatalk ID verify faile!"); } } } if (!empty($status)) { $response = new xmlrpcval(array('result' => new xmlrpcval(0, 'boolean'), 'result_text' => new xmlrpcval('', 'base64'), 'status' => new xmlrpcval($status, 'string')), 'struct'); return new xmlrpcresp($response); } } else { error("Invlaid params!"); } }
/** * * Redirect Output - steam_output_to_misc * - - - - - - - - - - - - - - - * @desc This function is holds the actions issued by the Steam Login plugin. * @since 1.0 * @version 1.6 * */ function steam_output_to_misc() { global $mybb, $db, $session; // The standard action to redirect the user to Steam community. if ($mybb->input['action'] == 'steam_login') { steam_redirect(); } // close if($mybb->input['action'] == 'steam_login') if ($mybb->input['action'] == 'steam_return') { $get_key = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_api_key'")); $check_update_username = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_update_username'")); $check_update_avatar = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_update_avatar'")); $check_avatar_size = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_avatar_size'")); $check_required_field = $db->fetch_array($db->simple_select("settings", "name, value", "name = 'steamlogin_required_field'")); if ($get_key['value'] == null) { die("<strong>Not Configured</strong> The Steam Login plugin hasn't been configured correctly. Please ensure an API key is set in the Configuration settings."); } else { require_once MYBB_ROOT . 'inc/class_steam.php'; require_once MYBB_ROOT . 'inc/class_lightopenid.php'; require_once MYBB_ROOT . 'inc/functions.php'; require_once MYBB_ROOT . 'inc/class_session.php'; $steam = new steam(); $steam_open_id = new LightOpenID(); $steam_open_id->validate(); $return_explode = explode('/', $steam_open_id->identity); $steamid = end($return_explode); $steam_info = $steam->get_user_info($steamid); // Check the status. if ($steam_info['status'] == 'success') { $steamid = $steam_info['steamid']; $personaname = $steam_info['personaname']; $profileurl = $steam_info['profileurl']; $avatar = $steam_info['avatars']['medium']; // Check the avatar size set in the database. if ($check_avatar_size['value'] == '0') { $avatar = $steam_info['avatars']['small']; } if ($check_avatar_size['value'] == '2') { $avatar = $steam_info['avatars']['large']; } $personaname = strip_tags($personaname); //This is so people can not use tags that display. $personaname = $db->escape_string($personaname); // Perform a check to see if the user already exists in the database. $user_check = $db->num_rows($db->simple_select("users", "*", "loginname = '{$steamid}'")); if ($user_check == 0) { $password = random_str(8); $email = $steamid . '@steamcommunity.com'; $default_usergroup = 2; // On a standard MyBB installation this is the group: Registered require_once MYBB_ROOT . "inc/datahandlers/user.php"; $userhandler = new UserDataHandler("insert"); $new_user_data = array("username" => $personaname, "password" => $password, "password2" => $password, "email" => $email, "email2" => $email, "avatar" => $avatar, "usergroup" => $default_usergroup, "displaygroup" => $default_usergroup, "website" => $profileurl, "regip" => $session->ipaddress, "longregip" => my_ip2long($session->ipaddress), "loginname" => $steamid); if ($check_required_field['value'] != "" and is_numeric($check_required_field['value'])) { // Check the field exists. $field_exists = $db->num_rows($db->simple_select("profilefields", "*", "fid = '" . $check_required_field['value'] . "'")); if ($field_exists > 0) { $new_user_data['profile_fields']['fid' . $check_required_field['value']] = $steamid; } } $userhandler->set_data($new_user_data); if ($userhandler->validate_user()) { $user_info = $userhandler->insert_user(); } // close if ($userhandler->validate_user()) } else { // close if($user_check == 0) $update = array(); // Init our update array. // Do our checks for both username and avatar. if ($check_update_username['value'] == 1) { $update['username'] = $personaname; } if ($check_update_avatar['value'] == 1) { $update['avatar'] = $avatar; } // Run our update query if the array isn't empty. if (!empty($update)) { $db->update_query('users', $update, "loginname = '{$steamid}'"); } } // close else $user = $db->fetch_array($db->simple_select("users", "*", "loginname = '{$steamid}'")); // Login the user. my_setcookie("mybbuser", $user['uid'] . "_" . $user['loginkey'], true, true); my_setcookie("sid", $session->sid, -1, true); redirect("index.php", 'Your account has been authenticated and you have been logged in.<br/> Powered By <a href="http://www.steampowered.com" target="_blank">Steam</a>', 'Login via Steam'); } // close if($steam_info['status'] == 'success') } // close else } // close if($mybb->input['action'] == 'steam_login') }
<?php function my_ip2long($ip) { list($ip1, $ip2, $ip3, $ip4) = explode(".", $ip); return $ip1 * pow(256, 3) + $ip2 * pow(256, 2) + $ip3 * 256 + $ip4; } function my_long2ip($long) { $base = 256; $ip = ""; $i = 3; while ($long > 0) { $ip_index = floor($long / pow(256, $i)); $long -= pow($base, $i) * $ip_index; $ip .= $ip_index . "."; $i--; } return substr($ip, 0, -1); } $ip = "192.100.100.100"; // echo sprintf("%u", ip2long($ip));//3227804772 echo "<br>"; // echo long2ip($long_num); echo "<br>"; // echo my_ip2long($ip); echo "<br>"; echo $long_num = my_ip2long($ip); echo "<br>"; echo my_long2ip($long_num);
/** * Insert a thread into the database. * * @return array Array of new thread details, tid and visibility. */ function insert_thread() { global $db, $mybb, $plugins, $cache, $lang; // Yes, validating is required. if (!$this->get_validated()) { die("The thread needs to be validated before inserting it into the DB."); } if (count($this->get_errors()) > 0) { die("The thread is not valid."); } $thread =& $this->data; // Fetch the forum this thread is being made in $forum = get_forum($thread['fid']); // This thread is being saved as a draft. if ($thread['savedraft']) { $visible = -2; } else { // Decide on the visibility of this post. if (($forum['modthreads'] == 1 || $forum['modposts'] == 1) && !is_moderator($thread['fid'], "", $thread['uid'])) { $visible = 0; } else { $visible = 1; } // Are posts from this user being moderated? Change visibility if ($mybb->user['uid'] == $thread['uid'] && $mybb->user['moderateposts'] == 1) { $visible = 0; } } // Have a post ID but not a thread ID - fetch thread ID if ($thread['pid'] && !$thread['tid']) { $query = $db->simple_select("posts", "tid", "pid='{$thread['pid']}"); $thread['tid'] = $db->fetch_field($query, "tid"); } if ($thread['pid'] > 0) { $query = $db->simple_select("posts", "pid", "pid='{$thread['pid']}' AND uid='{$thread['uid']}' AND visible='-2'"); $draft_check = $db->fetch_field($query, "pid"); } else { $draft_check = false; } // Are we updating a post which is already a draft? Perhaps changing it into a visible post? if ($draft_check) { $this->thread_insert_data = array("subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "lastpost" => intval($thread['dateline']), "lastposter" => $db->escape_string($thread['username']), "visible" => $visible); $plugins->run_hooks("datahandler_post_insert_thread", $this); $db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'"); $this->post_insert_data = array("subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "message" => $db->escape_string($thread['message']), "ipaddress" => $db->escape_string(get_ip()), "includesig" => $thread['options']['signature'], "smilieoff" => $thread['options']['disablesmilies'], "visible" => $visible); $plugins->run_hooks("datahandler_post_insert_thread_post", $this); $db->update_query("posts", $this->post_insert_data, "pid='{$thread['pid']}'"); $this->tid = $thread['tid']; $this->pid = $thread['pid']; } else { $this->thread_insert_data = array("fid" => $thread['fid'], "subject" => $db->escape_string($thread['subject']), "prefix" => intval($thread['prefix']), "icon" => intval($thread['icon']), "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "lastpost" => intval($thread['dateline']), "lastposter" => $db->escape_string($thread['username']), "views" => 0, "replies" => 0, "visible" => $visible, "notes" => ''); $plugins->run_hooks("datahandler_post_insert_thread", $this); $this->tid = $db->insert_query("threads", $this->thread_insert_data); $this->post_insert_data = array("tid" => $this->tid, "fid" => $thread['fid'], "subject" => $db->escape_string($thread['subject']), "icon" => intval($thread['icon']), "uid" => $thread['uid'], "username" => $db->escape_string($thread['username']), "dateline" => intval($thread['dateline']), "message" => $db->escape_string($thread['message']), "ipaddress" => $db->escape_string(get_ip()), "longipaddress" => intval(my_ip2long(get_ip())), "includesig" => $thread['options']['signature'], "smilieoff" => $thread['options']['disablesmilies'], "visible" => $visible); $plugins->run_hooks("datahandler_post_insert_thread_post", $this); $this->pid = $db->insert_query("posts", $this->post_insert_data); // Now that we have the post id for this first post, update the threads table. $firstpostup = array("firstpost" => $this->pid); $db->update_query("threads", $firstpostup, "tid='{$this->tid}'"); } // If we're not saving a draft there are some things we need to check now if (!$thread['savedraft']) { if ($thread['options']['subscriptionmethod'] != "" && $thread['uid'] > 0) { switch ($thread['options']['subscriptionmethod']) { case "instant": $notification = 1; break; default: $notification = 0; } require_once MYBB_ROOT . "inc/functions_user.php"; add_subscribed_thread($this->tid, $notification, $thread['uid']); } // Perform any selected moderation tools. if (is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions'])) { $lang->load($this->language_file, true); $modoptions = $thread['modoptions']; $modlogdata['fid'] = $this->tid; $modlogdata['tid'] = $thread['tid']; // Close the thread. if ($modoptions['closethread'] == 1) { $newclosed = "closed=1"; log_moderator_action($modlogdata, $lang->thread_closed); } // Stick the thread. if ($modoptions['stickthread'] == 1) { $newstick = "sticky='1'"; log_moderator_action($modlogdata, $lang->thread_stuck); } // Execute moderation options. if ($newstick && $newclosed) { $sep = ","; } if ($newstick || $newclosed) { $db->write_query("\n\t\t\t\t\t\tUPDATE " . TABLE_PREFIX . "threads\n\t\t\t\t\t\tSET {$newclosed}{$sep}{$newstick}\n\t\t\t\t\t\tWHERE tid='{$this->tid}'\n\t\t\t\t\t"); } } if ($visible == 1) { // If we have a registered user then update their post count and last post times. if ($thread['uid'] > 0) { $user = get_user($thread['uid']); $update_query = array(); // Only update the lastpost column of the user if the date of the thread is newer than their last post. if ($thread['dateline'] > $user['lastpost']) { // Yes this has a single quote within a double quote. It's not a bug. $update_query['lastpost'] = "'{$thread['dateline']}'"; } // Update the post count if this forum allows post counts to be tracked if ($forum['usepostcounts'] != 0) { $update_query['postnum'] = "postnum+1"; } // Only update the table if we need to. if (!empty($update_query)) { $db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true); } } if (!$forum['lastpost']) { $forum['lastpost'] = 0; } $done_users = array(); // Queue up any forum subscription notices to users who are subscribed to this forum. $excerpt = my_substr($thread['message'], 0, $mybb->settings['subscribeexcerpt']) . $lang->emailbit_viewthread; // Parse badwords require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); $excerpt = $parser->parse_badwords($excerpt); $query = $db->query("\n\t\t\t\t\tSELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate\n\t\t\t\t\tFROM " . TABLE_PREFIX . "forumsubscriptions fs\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=fs.uid)\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "usergroups g ON (g.gid=u.usergroup)\n\t\t\t\t\tWHERE fs.fid='" . intval($thread['fid']) . "'\n\t\t\t\t\tAND fs.uid != '" . intval($thread['uid']) . "'\n\t\t\t\t\tAND u.lastactive > '{$forum['lastpost']}'\n\t\t\t\t\tAND g.isbannedgroup != 1\n\t\t\t\t"); while ($subscribedmember = $db->fetch_array($query)) { if ($done_users[$subscribedmember['uid']]) { continue; } $done_users[$subscribedmember['uid']] = 1; $forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']); if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) { continue; } if (!is_moderator($thread['fid'], "", $subscribedmember['uid']) && $forumpermissions['canonlyviewownthreads'] == 1) { // In a 'view own only' forum and not a moderator continue; } // Determine the language pack we'll be using to send this email in and load it if it isn't already. if ($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language'])) { $uselang = $subscribedmember['language']; } else { if ($mybb->settings['bblanguage']) { $uselang = $mybb->settings['bblanguage']; } else { $uselang = "english"; } } if ($uselang == $mybb->settings['bblanguage']) { $emailsubject = $lang->emailsubject_forumsubscription; $emailmessage = $lang->email_forumsubscription; } else { if (!isset($langcache[$uselang]['emailsubject_forumsubscription'])) { $userlang = new MyLanguage(); $userlang->set_path(MYBB_ROOT . "inc/languages"); $userlang->set_language($uselang); $userlang->load("messages"); $langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription; $langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription; unset($userlang); } $emailsubject = $langcache[$uselang]['emailsubject_forumsubscription']; $emailmessage = $langcache[$uselang]['email_forumsubscription']; } $emailsubject = $lang->sprintf($emailsubject, $forum['name']); $post_code = md5($subscribedmember['loginkey'] . $subscribedmember['salt'] . $subscribedmember['regdate']); $emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid'], $post_code); $new_email = array("mailto" => $db->escape_string($subscribedmember['email']), "mailfrom" => '', "subject" => $db->escape_string($emailsubject), "message" => $db->escape_string($emailmessage), "headers" => ''); $db->insert_query("mailqueue", $new_email); unset($userlang); $queued_email = 1; } // Have one or more emails been queued? Update the queue count if ($queued_email == 1) { $cache->update_mailqueue(); } } } // Assign any uploaded attachments with the specific posthash to the newly created post. if ($thread['posthash']) { $thread['posthash'] = $db->escape_string($thread['posthash']); $attachmentassign = array("pid" => $this->pid, "posthash" => ''); $db->update_query("attachments", $attachmentassign, "posthash='{$thread['posthash']}' AND pid='0'"); } if ($visible == 1) { update_thread_data($this->tid); update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1")); } else { if ($visible == 0) { update_thread_data($this->tid); update_thread_counters($this->tid, array("replies" => 0)); update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1")); } } $query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'"); $attachmentcount = $db->fetch_field($query, "attachmentcount"); if ($attachmentcount > 0) { update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}")); } // Return the post's pid and whether or not it is visible. return array("pid" => $this->pid, "tid" => $this->tid, "visible" => $visible); }
/** * Load a user via the user credentials. * * @param int The user id. * @param string The user's loginkey. */ function load_user($uid, $loginkey = '') { global $mybb, $db, $time, $lang, $mybbgroups, $session, $cache; // Read the banned cache $bannedcache = $cache->read("banned"); // If the banned cache doesn't exist, update it and re-read it if (!is_array($bannedcache)) { $cache->update_banned(); $bannedcache = $cache->read("banned"); } $uid = intval($uid); $query = $db->query("\r\n\t\t\tSELECT u.*, f.*\r\n\t\t\tFROM " . TABLE_PREFIX . "users u\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\r\n\t\t\tWHERE u.uid='{$uid}'\r\n\t\t\tLIMIT 1\r\n\t\t"); $mybb->user = $db->fetch_array($query); if (!empty($bannedcache[$uid])) { $banned_user = $bannedcache[$uid]; $mybb->user['bandate'] = $banned_user['dateline']; $mybb->user['banlifted'] = $banned_user['lifted']; $mybb->user['banoldgroup'] = $banned_user['oldgroup']; $mybb->user['banolddisplaygroup'] = $banned_user['olddisplaygroup']; $mybb->user['banoldadditionalgroups'] = $banned_user['oldadditionalgroups']; } // Check the password if we're not using a session if (empty($loginkey) || $loginkey != $mybb->user['loginkey'] || !$mybb->user['uid']) { unset($mybb->user); $this->uid = 0; return false; } $this->uid = $mybb->user['uid']; // Set the logout key for this user $mybb->user['logoutkey'] = md5($mybb->user['loginkey']); // Sort out the private message count for this user. if (($mybb->user['totalpms'] == -1 || $mybb->user['unreadpms'] == -1) && $mybb->settings['enablepms'] != 0) { $update = 0; if ($mybb->user['totalpms'] == -1) { $update += 1; } if ($mybb->user['unreadpms'] == -1) { $update += 2; } require_once MYBB_ROOT . "inc/functions_user.php"; $pmcount = update_pm_count('', $update); if (is_array($pmcount)) { $mybb->user = array_merge($mybb->user, $pmcount); } } $mybb->user['pms_total'] = $mybb->user['totalpms']; $mybb->user['pms_unread'] = $mybb->user['unreadpms']; if ($mybb->user['lastip'] != $this->ipaddress && array_key_exists('lastip', $mybb->user)) { $lastip_add = ", lastip='" . $db->escape_string($this->ipaddress) . "', longlastip='" . intval(my_ip2long($this->ipaddress)) . "'"; } else { $lastip_add = ''; } // If the last visit was over 900 seconds (session time out) ago then update lastvisit. $time = TIME_NOW; if ($time - $mybb->user['lastactive'] > 900) { $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET lastvisit='{$mybb->user['lastactive']}', lastactive='{$time}'{$lastip_add} WHERE uid='{$mybb->user['uid']}'"); $mybb->user['lastvisit'] = $mybb->user['lastactive']; require_once MYBB_ROOT . "inc/functions_user.php"; update_pm_count('', 2); } else { $timespent = TIME_NOW - $mybb->user['lastactive']; $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET lastactive='{$time}', timeonline=timeonline+{$timespent}{$lastip_add} WHERE uid='{$mybb->user['uid']}'"); } // Sort out the language and forum preferences. if ($mybb->user['language'] && $lang->language_exists($mybb->user['language'])) { $mybb->settings['bblanguage'] = $mybb->user['language']; } if ($mybb->user['dateformat'] != 0 && $mybb->user['dateformat'] != '') { global $date_formats; if ($date_formats[$mybb->user['dateformat']]) { $mybb->settings['dateformat'] = $date_formats[$mybb->user['dateformat']]; } } // Choose time format. if ($mybb->user['timeformat'] != 0 && $mybb->user['timeformat'] != '') { global $time_formats; if ($time_formats[$mybb->user['timeformat']]) { $mybb->settings['timeformat'] = $time_formats[$mybb->user['timeformat']]; } } // Find out the threads per page preference. if ($mybb->user['tpp']) { $mybb->settings['threadsperpage'] = $mybb->user['tpp']; } // Find out the posts per page preference. if ($mybb->user['ppp']) { $mybb->settings['postsperpage'] = $mybb->user['ppp']; } // Does this user prefer posts in classic mode? if ($mybb->user['classicpostbit']) { $mybb->settings['postlayout'] = 'classic'; } else { $mybb->settings['postlayout'] = 'horizontal'; } // Check if this user is currently banned and if we have to lift it. if (!empty($mybb->user['bandate']) && (isset($mybb->user['banlifted']) && !empty($mybb->user['banlifted'])) && $mybb->user['banlifted'] < $time) { // must have been good.. bans up :D $db->shutdown_query("UPDATE " . TABLE_PREFIX . "users SET usergroup='" . intval($mybb->user['banoldgroup']) . "', additionalgroups='" . $mybb->user['oldadditionalgroups'] . "', displaygroup='" . intval($mybb->user['olddisplaygroup']) . "' WHERE uid='" . $mybb->user['uid'] . "' LIMIT 1"); $db->shutdown_query("DELETE FROM " . TABLE_PREFIX . "banned WHERE uid='" . $mybb->user['uid'] . "'"); // we better do this..otherwise they have dodgy permissions $mybb->user['usergroup'] = $mybb->user['banoldgroup']; $mybb->user['displaygroup'] = $mybb->user['banolddisplaygroup']; $mybb->user['additionalgroups'] = $mybb->user['banoldadditionalgroups']; $cache->update_banned(); $mybbgroups = $mybb->user['usergroup']; if ($mybb->user['additionalgroups']) { $mybbgroups .= ',' . $mybb->user['additionalgroups']; } } else { if (!empty($mybb->user['bandate']) && (empty($mybb->user['banlifted']) || !empty($mybb->user['banlifted']) && $mybb->user['banlifted'] > $time)) { $mybbgroups = $mybb->user['usergroup']; } else { // Gather a full permission set for this user and the groups they are in. $mybbgroups = $mybb->user['usergroup']; if ($mybb->user['additionalgroups']) { $mybbgroups .= ',' . $mybb->user['additionalgroups']; } } } $mybb->usergroup = usergroup_permissions($mybbgroups); if (!$mybb->user['displaygroup']) { $mybb->user['displaygroup'] = $mybb->user['usergroup']; } $mydisplaygroup = usergroup_displaygroup($mybb->user['displaygroup']); if (is_array($mydisplaygroup)) { $mybb->usergroup = array_merge($mybb->usergroup, $mydisplaygroup); } if (!$mybb->user['usertitle']) { $mybb->user['usertitle'] = $mybb->usergroup['usertitle']; } // Update or create the session. if (!defined("NO_ONLINE")) { if (!empty($this->sid)) { $this->update_session($this->sid, $mybb->user['uid']); } else { $this->create_session($mybb->user['uid']); } } return true; }