The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
code help
Ok I managed to get alot of this ported hack working, but when I go into my admincp->users->my admin account->Add Linked Accounts to (user)
I then enter the userid to link to, a list of all accounts show up, that doesn't bother me, I click on (Link) which then is supposed to link the 2 accounts together but instead it does nothing, its supposed to give a message stating the accounts were linked. Any ideas what could be wrong? I am providing the code that I had to use and the qas.php file. If you wish to look over it and provide better feedback, please do. It suggested I check that 'u' is being converted to 'userid' but I have no clue what I'm looking for when it comes to that. global.php add in code: HTML Code:
# Quick Account Switch v1.2 unset($account_master); // empty markup for good measure if ($bbuserinfo['userid']) // verify we are logged on { if ($bbuserinfo['qas']) // slave or master account defined? { $qas = unserialize($bbuserinfo['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qas_acct_value[userid]\">" . base64_decode($qas_acct_value['username']) ."</a></td></tr>"; } else // we are a slave account to this master account { $qasmast=fetch_userinfo($qas_acct_value['userid'], 0); // get master account's QAS details // add master account at the top of the list $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qasmast[userid]\">$qasmast[username]</a></td></tr>"; // add all slaves except myself $qas2 = unserialize($qasmast['qas']); foreach ($qas2 as $qas_acct2 => $qas_acct_value2) { if ($qas_acct_value2['userid'] != $bbuserinfo['userid']) // if I'm not this slave { $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qas_acct_value2[userid]\">" . base64_decode($qas_acct_value2['username']) . "</a></td></tr>"; } } } } } } # /Quick Account Switch v1.2 HTML Code:
// ##### start do switch # Quick Account Switch v1.2 ##### if ($_REQUEST['do'] == 'switch') { globalize($_REQUEST, array('url' => STR, 'userid' => INT)); $allow_switch = false; if (($bbuserinfo['userid']) && $_REQUEST['id']) { $id_from = $bbuserinfo['userid']; $id_to = $_REQUEST['id']; if ($bbuserinfo['qas']) // slave or master account defined? { $qas = unserialize($bbuserinfo['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { if ($id_to == $qas_acct_value['userid']) $allow_switch = true; } else // we are a slave account to this master account { if ($id_to == $qas_acct_value['userid']) { // are we switching to the master account? $allow_switch = true; } else { // check the slaves $qasmast=fetch_userinfo($qas_acct_value['userid'], 0); // get master account's QAS details // allow switching to all but myself, since that's futile $qas2 = unserialize($qasmast['qas']); foreach ($qas2 as $qas_acct2 => $qas_acct_value2) { if ($qas_acct_value2['userid'] != $bbuserinfo['userid']) // if I'm not this slave { if ($id_to == $qas_acct_value2['userid']) $allow_switch = true; } } } } } } } if ($logintype === 'cplogin' OR $logintype === 'modcplogin') $allow_switch = false; if ($allow_switch == false) { eval(print_standard_error('logout_missing_userid')); } else { // clear all cookies beginning with COOKIE_PREFIX $prefix_length = strlen(COOKIE_PREFIX); foreach ($_COOKIE AS $key => $val) { $index = strpos($key, COOKIE_PREFIX); if ($index == 0 AND $index !== false) { $key = substr($key, $prefix_length); if (trim($key) == '') { continue; } if ($key != 'sessionhash') vbsetcookie($key, '', 1); } } if ($bbuserinfo['userid'] != 0 AND $bbuserinfo['userid'] != -1) { $DB_site->query(" UPDATE " . TABLE_PREFIX . "user SET lastactivity = " . (TIMENOW - $vboptions['cookietimeout']) . ", lastvisit = " . TIMENOW . " WHERE userid = $bbuserinfo[userid] "); // make sure any other of this user's sessions are deleted (in case they ended up with more than one) $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE userid = $bbuserinfo[userid]"); } // clear current sessionhash $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . addslashes($session['dbsessionhash']) . "'"); // so much for logging out, lets login the assumed user $bbuserinfo = $DB_site->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE userid = '" . $id_to . "'"); vbsetcookie('userid', $bbuserinfo['userid']); // *** put your license code here or it'll not work *** you can find it at the top of this file (login.php) // the format is Lxxxxxxx, where 'xxxxxxx' is a set of numbers/letters, 0-9, a-f. // replace <*** your license code ***> in the next line with this code, between the single quotes. vbsetcookie('password', md5($bbuserinfo['password'] . '<*** your license code ***>')); exec_unstrike_user($bbuserinfo['username']); $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . addslashes($session['dbsessionhash']) . "'"); $session['sessionhash'] = fetch_sessionhash(); $session['dbsessionhash'] = $session['sessionhash']; $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "session (sessionhash, userid, host, idhash, lastactivity, styleid, loggedin, bypass, useragent) VALUES ('" . addslashes($session['sessionhash']) . "', " . intval($bbuserinfo['userid']) . ", '" . addslashes(SESSION_HOST) . "', '" . addslashes(SESSION_IDHASH) . "', " . TIMENOW . ", $session[styleid], 1, " . iif ($logintype === 'cplogin', 1, 0) . ", '" . addslashes(USER_AGENT) . "') "); vbsetcookie('sessionhash', $session['sessionhash'], 0); if ($nosessionhash == 1) { // if user is working through cookies, blank out the sessionhash $shash = $session['sessionhash'] = ''; $surl = $session['sessionurl'] = ''; $surlJS = $session['sessionurl_js'] = ''; } else { $shash = $session['sessionhash']; $surl = $session['sessionurl'] = 's=' . $session['sessionhash'] . '&'; $surlJS = $session['sessionurl_js'] = 's=' . $session['sessionhash'] . '&'; } if ($url == 'login.php' OR $url == "$vboptions[forumhome].php" OR strpos($url, 'do=logout') !== false) { $url = "$vboptions[forumhome].php?$surl"; } else { $url = fetch_replaced_session_url($url); } $postvars = construct_hidden_var_fields($postvars); $temp = strpos($url, '?'); if ($temp) { $formfile = substr($url, 0, $temp); } else { $formfile = $url; } eval(print_standard_redirect('redirect_login')); } } HTML Code:
// Quick Account Switch 1.2 - Start $qas_is_slave=false; print_table_header($vbphrase['qas_version']); if (!empty($user['qas'])) { $qas = unserialize($user['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { $qas_link = "(<a href=\"user.php?$session[sessionurl]&do=edit&u=$qas_acct_value[userid]\">$vbphrase[profile]</a>)"; // parameters: u2 (slave), u (master) $qas_link .= " (<a href=\"qas.php?$session[sessionurl]&do=qasunlink&u=$user[userid]&u2=$qas_acct_value[userid]\">$vbphrase[qas_unlink]</a>)"; print_label_row($vbphrase['qas_master_to'] . ' ' . base64_decode($qas_acct_value['username']), $qas_link); } else // we are a slave account to this master account { $qas_link = "(<a href=\"user.php?$session[sessionurl]&do=edit&u=$qas_acct_value[userid]\">$vbphrase[profile]</a>)"; $qas_link .= " (<a href=\"qas.php?$session[sessionurl]&do=qasunlink&u=$qas_acct_value[userid]&u2=$user[userid]\">$vbphrase[qas_unlink]</a>)"; print_label_row($vbphrase['qas_slave_to'] . ' ' . base64_decode($qas_acct_value['username']), $qas_link); $qas_is_slave = true; } } } else { print_label_row($vbphrase['qas_no_accounts'], '', '', 'top', 'noslaves'); } if (!$qas_is_slave) { $qas_link = " <a href=\"qas.php?$session[sessionurl]&do=qaslink&u=$user[userid]\">$vbphrase[qas_add_to] $user[username]</a>"; print_description_row($qas_link); } print_table_break('', $INNERTABLEWIDTH); // Quick Account Switch 1.2 - End Cheers and thanks Myth |
#3
|
|||
|
|||
First what i notice is that you still have references to vB3.0 variables, such as $bbuserinfo (this should be $vbulletin->userinfo), and $DB_site ($vbulletin->db).
|
#4
|
|||
|
|||
Tried but no go, he is MIA, his partner said ok to it as long as credit was pointed back to Ianomed so that is what I'm doing.
Marco, I was told to change $DB_site to $db only. Am I wrong in doing that? Ok changed what you suggested Marco and still same problem. I am just wondering why its not inserting the information into the database once I click on (Link) right next to the username. I providing a screenshot of where the link is. Hope you can see the image clear enough. |
#5
|
||||
|
||||
$db is fine in global context.
Did you actually do anything with this Code? Looks like 100% 3.0 ... |
#6
|
|||
|
|||
That is one of my small problems, I have been changing the code over to 3.5 as much as possible, that is why I posted up the code and the file as I need to know what has to be changed in it to match 3.5 as I pretty much have come to a dead in. No more errors when entering the linking section but now it just doesn't want to enter the information into the database.
But if I have $vbulletin->db I'm still ok, right? |
#7
|
||||
|
||||
I wonder how you ported anything without knowing the basics ...
$vboptions = $vbulletin->options $DB_site = $db (Or $vbulletin->db, it's the same anyway) $bbuserinfo = $vbulletin->userinfo $session = $vbulletin->session->vars addslashes() = $db->escape_string() globalize = $vbulletin->input->clean_array_gpc, the Types have also changed print_standard_error() = standard_error(fetch_error()) Change all that, check if there are errors - and then ask again |
#8
|
|||
|
|||
LOL
Kirby, I managed to port by just trying certain things, getting errors, and changing to other things. But now its becoming a bit trickier. Ok going to check those now. Quick on globalize, should that be $vbulletin->input->clean_array_gpc or $vbulletin->input->clean_gpc ? Ok done, found quite a few spots I missed for $DB_site No errors just that its still not inserting info into the database. Well I'm off to bed to sleep a bit, I will look forward to seeing you reply. Thanks Kirby and Marco. Cheers Myth (Steve) EDIT: Ok no go as of yet, not sure what else needs to be checked. Anyone that can list what has changed since 3.0.x then I can easily go through and double check my work. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|