Updating an old vBulletin 3.x product

I am trying to update an old vBulletin 3.x series product and I am getting errors left and right. I have all the basic functions working, but then I’ll stumble across something not working correctly. This latest error I am having trouble with is “Creating default object from empty value” (Line 505) I have looked over this code thoroughly, but my PHP knowledge is not good enough to decipher this one. I posted the function on stack and have not received much help. I have also scoured stack to find anything similar to the way it is done in this script, to no avail. This is the ENTIRE page, I am asking for any help making this more up to date, and help with correcting any errors, some of the variables and functions in this script will be default vBulletin stuff but I hope someone here will still be able to help with this. This error comes up when a user submits their billing details to store in their profile.

<?php
class vbma
{
    var $vbulletin;
    var $fields = array(//Array of commonly used filed names, Also alows intergration
		'custnum' => 'custnum',//Key (short name) => Value (database table name)
		'mpassword' => 'ma_password',
		'info' => 'ma_info'
	);
    var $currency_sym;
    var $vbphrase;
    var $addons = array();
    function vbma(&$vbulletin, &$vbphrase)
    {
        $this->vbulletin = &$vbulletin;
        $this->vbphrase = &$vbphrase;
        foreach (glob("includes/class_vbma*.php") as $addon)
        {
            if ($addon == 'includes/class_vbma.php')
            {
                continue;
            }
            require_once (DIR . '/' . $addon);
            $addon = basename(substr($addon, 19, strlen($addon)), '.php');
            $name = 'vbma_' . $addon;
            $this->$addon = new $name($this);
            $this->addons["$addon"] = $addon;
        }
    }

    function init($permissions)
    {
        $vbphrase = &$this->vbphrase;
        $this->canViewMemArea($permissions);
        if ($this->vbulletin->options['memarea_enabled'] == 0 and !($this->vbulletin->
            userinfo['permissions']['adminpermissions'] & $this->vbulletin->
            bf_ugp_adminpermissions['cancontrolpanel']))
        {
            eval(standard_error($this->vbulletin->options['memarea_offmessage']));
        } elseif ($this->vbulletin->options['memarea_enabled'] == 0 and $this->vbulletin->
        userinfo['permissions']['adminpermissions'] & $this->vbulletin->
            bf_ugp_adminpermissions['cancontrolpanel'])
        {
            $oringle = $vbphrase['alert_board_off'];
            $vbphrase['alert_board_off'] = $this->vbphrase['memarea_off'];
            eval('$GLOBALS[navbar] .= "' . fetch_template('board_inactive_warning') . '";');
        }

        foreach ($this->addons as $addon)
        {
            if (method_exists($this->$addon, 'init'))
            {
                $this->$addon->init();
            }
        }
        $maxlength = TIMENOW - (60 * 60 * 24 * 3);
        $GLOBALS['ma_session'] = $this->vbulletin->db->query_first("SELECT * FROM " .
            TABLE_PREFIX . "ma_session WHERE userid = '" . $this->vbulletin->userinfo['userid'] .
            "' AND dateline > '" . $maxlength . "'");
        $GLOBALS['curr'] = $this->getCurrency();
        $this->currency_sym = $GLOBALS['currency_sym'] = $this->vbulletin->options['memarea_curr_code'];

    }

    function checkCustomerInfo($customernum, $password)
    {
        $fcust = $this->fields['custnum'];
        $fpass = $this->fields['mpassword'];
        if ($this->vbulletin->userinfo["$fcust"] == $customernum and $this->vbulletin->
            userinfo["$fpass"] == $password)
        {
            return true;
        }
        return false;
    }

    function startSession($userid)
    {
        $this->vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX .
            "ma_session (`userid`, `dateline`) VALUES (
			'" . $this->vbulletin->db->escape_string($this->vbulletin->userinfo['userid']) .
            "', '" . TIMENOW . "'
		)");
    }

    function getCurrency()
    {
        $curr_a = array('$' => 'USD', $this->vbphrase['memarea_currency_eur'] => 'EUR',
            $this->vbphrase['memarea_currency_pound'] => 'GBP', $this->vbphrase['memarea_currency_nis'] =>
            'NIS');
        return $curr_a[$this->vbulletin->options['memarea_curr_code']];
    }

    function getPaypalAddress(&$license)
    {
        $paypal = $license['paypal'];
        if (empty($paypal) or $paypal == '0')
        {
            $paypal = $this->vbulletin->options['memarea_paypal_email'];
        }
        return $paypal;
    }

    function getLicense($licenseid, $checkpermission = true, $getproduct = true, $productfields =
        'products.id as proid, products.title as protitle', $throwerror = true, $getExpireDate = true,
        $showExpiredErrors = false, $showSusErrors = false)
    {
        if ($getproduct)
        {
            $license = $this->vbulletin->db->query_first("SELECT licenses.*, $productfields FROM " .
                TABLE_PREFIX . "ma_licenses as licenses 
				LEFT JOIN " . TABLE_PREFIX .
                "ma_products as products ON (products.id = licenses.productid)
				WHERE licenses.id = '" . $licenseid . "'");
        }
        else
        {
            $license = $this->vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX .
                "ma_licenses WHERE id = '" . $licenseid . "'");
        }
        if ($throwerror and empty($license))
        {
            eval(standard_error(fetch_error('license_not_found')));
        }
        if ($checkpermission and $this->vbulletin->userinfo['userid'] !== $license['userid'])
        {
            print_no_permission();
        }
        if ($getExpireDate)
        {
            $license['expiredate'] = $this->getLicenseExpireDate($license);
        }
        if ($showExpiredErrors and $this->isExpired($license))
        {
            eval(standard_error(fetch_error('memarea_license_expired')));
        }
        if ($showSusErrors and $this->isSuspended($license))
        {
            eval(standard_error(fetch_error('memarea_suspended_license')));
        }
        return $license;
    }

    function isExpired(&$license)
    {
        if (intval($license['status']) == 0 or ($license['expire'] !== '0' and (($license['dateline'] +
            $license['expire']) <= TIMENOW)))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    function isSuspended(&$license)
    {
        if (intval($license['status']) == 1)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    function getLicenseExpireDate(&$license)
    {
        if ($license['expire'] == '0')
        {
            return $this->vbphrase['memarea_lifetime'];
        }
        else
        {
            return vbdate($this->vbulletin->options['dateformat'], ($license['dateline'] + $license['expire']));
        }
    }

    function sendCustomerInfo($userid, $username, $email, $num, $pass)
    {
        if ($this->vbulletin->options['memarea_notification_type'] == 0 or $this->
            vbulletin->options['memarea_notification_type'] == 2)
        {
            vbmail($email, $this->vbphrase['memarea_email_subject'], construct_phrase($this->
                vbphrase['memarea_email_message'], $num, $pass));
        }
        if ($this->vbulletin->options['memarea_notification_type'] == 1 or $this->
            vbulletin->options['memarea_notification_type'] == 2)
        {
            $pmdm = datamanager_init('PM', $this->vbulletin, ERRTYPE_ARRAY);
            $pmdm->set('fromuserid', $this->vbulletin->options['memarea_botuser']);
            $fuserinfo = $this->vbulletin->db->query_first("SELECT username FROM " .
                TABLE_PREFIX . "user WHERE userid = '" . $this->vbulletin->options['memarea_botuser'] .
                "'");
            $pmdm->set('fromusername', $fuserinfo['username']);
            $pmdm->set('title', $this->vbphrase['memarea_email_subject']);
            $pmdm->set('message', construct_phrase($this->vbphrase['memarea_email_message'],
                $num, $pass));
            $botpermissions = array();
            $botpermissions['adminpermissions'] = 2;
            $pmdm->set_recipients($username, $botpermissions);
            $pmdm->set('dateline', TIMENOW);
            $pmdm->pre_save();
            if (count($pmdm->errors) == 0)
            {
                $pmdm->save();
            }
            else
            {
                var_dump($pmdm->errors);
            }
        }
    }

    function setCustomerNumber($ma_info, $usergroup = '', $usevb = true, $userinfo = '')
    {
        if ($usevb == false)
        {
            $this->vbulletin->userinfo = &$userinfo;
        }
        $fcust = $this->fields['custnum'];
        $fpass = $this->fields['mpassword'];
        $finfo = $this->fields['info'];
        $userdm = datamanager_init('User', $this->vbulletin, ERRTYPE_ARRAY);
        $userinfo = fetch_userinfo($this->vbulletin->userinfo['userid']);
        $userdm->set_existing($userinfo);
        if (!$this->vbulletin->userinfo["$fcust"] and !$this->vbulletin->userinfo["$fpass"])
        {
            $rand = rand($this->vbulletin->options['memarea_numstart'], $this->vbulletin->
                options['memarea_numend']);
            $num = $this->vbulletin->options['custnum_prefix'] . substr(md5($rand), 0, $this->
                vbulletin->options['memarea_custnumleng'] - strlen($this->vbulletin->options['custnum_prefix']));
            $userdm->set($fcust, $num);
            $pass = substr(md5(time() . $num . $rand . rand(0, 2000)), 0, $this->vbulletin->
                options['memarea_custnumleng']);
            $userdm->set($fpass, $pass);
            $this->sendCustomerInfo($this->vbulletin->userinfo['userid'], $this->vbulletin->
                userinfo['username'], $this->vbulletin->userinfo['email'], $num, $pass);
        }
        if ($usergroup or $usergroup !== '' or $usergroup !== '0')
        {
        	if ($usergroup != $this->vbulletin->userinfo['usergroupid'])
        	{
            $ma_info['oldgroup'] = $this->vbulletin->userinfo['usergroupid'];
            $userdm->set('usergroupid', $usergroup);
            }
        }
        if ($ma_info)
        {
            $ma_info = serialize($ma_info);
            $userdm->set($finfo, $ma_info);
        }

        $userdm->pre_save();
        if (count($userdm->errors) == 0)
        {
            $userdm->save();
            return true;
        }
        else
        {
            var_dump($userdm->errors);
            return false;
        }
    }

    function checkProductPermissions(&$product)
    {
        $perm = unserialize($product['permissions']);
        return in_array($this->vbulletin->userinfo['usergroupid'], $perm);
    }

    function buildInfoValues()
    {
        $values = array();
        if (is_array($this->vbulletin->userinfo['ma_info']))
        {
            foreach ($this->vbulletin->userinfo['ma_info'] as $key => $value)
            {
                if (!$this->vbulletin->GPC["$key"])
                {
                    $values["$key"] = $value;
                }
            }
        }
        return $values;
    }

    function canViewMemArea($permissions)
    {
        if (!($permissions['memarea_permissions'] & $this->vbulletin->bf_ugp['memarea_permissions']['memarea_active']))
        {
            print_no_permission();
        }
    }

    function buildInfoArray()
    {
        return array('fullname' => $this->vbulletin->GPC['fullname'], 'address_1' => $this->
            vbulletin->GPC['address_1'], 'address_2' => $this->vbulletin->GPC['address_2'],
            'address_city' => $this->vbulletin->GPC['address_city'], 'address_state' => $this->
            vbulletin->GPC['address_state'], 'address_zip' => $this->vbulletin->GPC['address_zip'],
            'country' => $this->vbulletin->GPC['country'], 'phone' => $this->vbulletin->GPC['phone'],
            'company' => $this->vbulletin->GPC['company']);
    }

    function insertPurchaseInfo($ids, $information, $userid = 'usevb')
    {
        if ($userid == 'usevb')
        {
            $userid = $this->vbulletin->userinfo['userid'];
        }
        $this->vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX .
            "ma_purchases (`userid`, `dateline`, `order`, `info`) VALUES (
			'" . $userid . "',
			'" . TIMENOW . "',
			'" . $this->vbulletin->db->escape_string(serialize($ids)) . "',
			'" . $this->vbulletin->db->escape_string(serialize($information)) . "'
		)");
        return $this->vbulletin->db->insert_id();
    }

    function buildCartRow($page, $action, $title, $price, $id = 0, $multi = false)
    {
        $currency_sym = $this->currency_sym;
        $product = array('title' => $title, 'price' => $price);
        if ($page == 'billing')
        {
            $delname = 'del_item[' . $id . ']';
            eval('$return = "' . fetch_template('memarea_billingdetailsbit') . '";');
        }
        else
        {
            $_REQUEST['do'] = 'paymentdetails';
            eval('$return = "' . fetch_template('memarea_billingdetailsbit') . '";');
            $_REQUEST['do'] = $action;
        }
        return $return;
    }

    function sendOutNewSaleEmail()
    {
        if (!empty($this->vbulletin->options['memarea_email_new_sale']))
        {
            foreach (explode(",", $this->vbulletin->options['memarea_email_new_sale']) as $userid)
            {
                $userinfo = fetch_userinfo($userid);
                vbmail($userinfo['email'], construct_phrase($this->vbphrase['memarea_new_sale'],
                    $this->vbulletin->options['bbtitle']), construct_phrase($this->vbphrase['memarea_new_sale_body'],
                    $userinfo['username'], $this->vbulletin->options['bbtitle']));
                unset($userinfo);
            }
        }
    }

    function checkDetailsFields($requested, $errormessage)
    {
        if (empty($this->vbulletin->GPC['fullname']) or empty($this->vbulletin->GPC['address_1']) or
            empty($this->vbulletin->GPC['address_city']) or empty($this->vbulletin->GPC['address_zip']) or
            empty($this->vbulletin->GPC['country']) or empty($this->vbulletin->GPC['phone']))
        {
            //$GLOBALS['error'] = $errormessage;
            eval(standard_error($errormessage));
            //$this->handleRequest($requested);
            return false;
        }
        return true;
    }

    function handleRequest($do)
    {
        $method = 'handleRequest' . $do;
        if (method_exists($this, $method))
        {
            $this->{$method}();
        }
        foreach ($this->addons as $addon)
        {
            if (method_exists($this->{$addon}, $method))
            {
                $this->{$addon}->{$method}();
            }
        }
    }

    function handleRequestgivelicense()
    {
        $vbphrase = &$this->vbphrase;
        $GLOBALS['id'] = $this->vbulletin->input->clean_gpc('r', 'id', TYPE_UINT);
        $GLOBALS['license'] = $this->getLicense($GLOBALS['id'], true, false, '', true, false);
        $GLOBALS['templatename'] = 'memarea_givelicense';
    }

    function handleRequestdogivelicense()
    {
        $vbphrase = &$this->vbphrase;
        $id = $this->vbulletin->input->clean_gpc('r', 'licenseid', TYPE_UINT);
        $username = $this->vbulletin->input->clean_gpc('r', 'usernames', TYPE_STR);
        $userinfo = $this->vbulletin->db->query_first("SELECT userid FROM " .
            TABLE_PREFIX . "user WHERE username = '" . $username . "'");
        if (empty($userinfo))
        {
            $GLOBALS['message'] = $vbphrase['memarea_givelicense_not_found'];
            $this->handleRequestgivelicense();
        }
        else
        { //User exists
            $license = $this->getLicense($id, true, false, '', true, false);
            $licensedm = datamanager_init('License', $this->vbulletin, ERRTYPE_ARRAY);
            $licensedm->set_existing($license);
            $licensedm->setr('userid', $userinfo['userid']);
            $licensedm->save();
            eval(standard_error($vbphrase['memarea_gave_license']));
        }
    }

    function handleRequestmembersarea()
    {
        $vbphrase = &$this->vbphrase;
        $licensesq = $this->vbulletin->db->query_read("SELECT licenses.*, licenses.title as sitetitle, products.title as title, products.licenseleng as expire FROM " .
            TABLE_PREFIX . "ma_licenses as licenses 
			LEFT JOIN " . TABLE_PREFIX .
            "ma_products as products ON (products.id = licenses.productid)
			WHERE licenses.userid = '" . $this->vbulletin->userinfo['userid'] . "'");
        $licenses = '';
        while ($license = $this->vbulletin->db->fetch_array($licensesq))
        {
            if (empty($license['sitetitle']))
            {
                $license['sitetitle'] = substr($license['url'], 7);
            }
            $license['expiredate'] = $this->getLicenseExpireDate($license);
            eval('$licenses .= "' . fetch_template('memarea_clientsbit') . '";');
        }
        if ($this->addons['helpdesk'])
        {
            $GLOBALS['tickets'] = $this->helpdesk->getTicketsBitMem();
        }
        $GLOBALS['licenses'] = &$licenses;
        $GLOBALS['templatename'] = 'memarea_clients';
    }

    function handleRequestlogout()
    {
        $this->vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX .
            "ma_session WHERE userid = '" . $this->vbulletin->userinfo['userid'] . "'");
        eval(standard_error($this->vbphrase['memarea_loggedout']));
    }

    function handleRequestlogin()
    {
        $this->vbulletin->input->clean_array_gpc('p', array('customernumber' => TYPE_STR,
            'password' => TYPE_STR));
        if ($this->checkCustomerInfo($this->vbulletin->GPC['customernumber'], $this->
            vbulletin->GPC['password']))
        {
            $this->startSession($this->vbulletin->userinfo['userid']);
            $this->handleRequest('membersarea');
            $GLOBALS['bypass'] = true;
        }
        else
        {
            $this->handleRequest('membersarea');
            $GLOBALS['errormessage'] = $this->vbphrase['memarea_bad_login'];
        }
    }

    function handleRequestresend_details()
    {
        $num = $this->vbulletin->userinfo['custnum'];
        $pass = $this->vbulletin->userinfo['ma_password'];
        $this->sendCustomerInfo($this->vbulletin->userinfo['userid'], $this->vbulletin->
            userinfo['username'], $this->vbulletin->userinfo['email'], $num, $pass);
        eval(standard_error($this->vbphrase['memarea_details_sent']));
    }

    function handleRequestlicence()
    {
        $GLOBALS['templatename'] = 'memarea_licence';
    }

    function handleRequestdetails()
    {
        $GLOBALS['values'] = $this->buildInfoValues();
        $GLOBALS['templatename'] = 'memarea_details';
    }

    function handleRequestsave_details()
    {
        $this->vbulletin->input->clean_array_gpc('p', array('fullname' => TYPE_STR,
            'address_1' => TYPE_STR, 'address_2' => TYPE_STR, 'address_city' => TYPE_STR,
            'address_state' => TYPE_STR, 'address_zip' => TYPE_STR, 'country' => TYPE_STR,
            'phone' => TYPE_STR, 'company' => TYPE_STR));
        if ($this->checkDetailsFields('details', $this->vbphrase['memarea_required_fields']))
        {
            $information = $this->buildInfoArray();
            $this->vbulletin->userinfo['ma_info'] = $information;
            $this->vbulletin->userinfo['usergroupid'] = $usergrpid;
            if ($this->setCustomerNumber($information, $usergrpid))
            {
                //$vbulletin->url = 'members.php?do=details';
                //eval(print_standard_redirect($this->vbphrase['memarea_saved_details'], false, true));
                $vbulletin->url = 'members.php?' . $vbulletin->session->vars['sessionurl'] . "do=details";
                eval(print_standard_redirect('memarea_saved_details', true, true));
            }
        }
    }

    function handleRequestproducts()
    {
        global $stylevar;
        $vbphrase = &$this->vbphrase;
        $products = $this->vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX .
            "ma_products");
        $pros = '';
        $haspro = ($this->addons['pro'] == 'pro');
        $currency_sym = $this->currency_sym;
        while ($product = $this->vbulletin->db->fetch_array($products))
        {
            if ($this->checkProductPermissions($product))
            {
                $file = DIR . '/images/productthumbs/' . basename('thumbnail_product_' . $product['id'] .
                    $product['thumbnail_ext']);
                $show['prodthumb'] = false;
                if (file_exists($file))
                {
                    $filename = 'images/productthumbs/' . basename('thumbnail_product_' . $product['id'] .
                        $product['thumbnail_ext']);
                    $show['prodthumb'] = true;
                }
                $product['description'] = fetch_trimmed_title($product['description'], $this->
                    vbulletin->options['memarea_description_length']);
                eval('$pros .= "' . fetch_template('memarea_productsbit') . '";');
            }
        }
        $GLOBALS['pros'] = &$pros;
        $GLOBALS['templatename'] = 'memarea_products';
    }

    function handleRequestrenewals()
    {
        $GLOBALS['id'] = $this->vbulletin->input->clean_gpc('g', 'id', TYPE_INT);
        $GLOBALS['mavals'] = $this->buildInfoValues();
        $GLOBALS['license'] = $this->getLicense($GLOBALS['id'], true, true,
            'products.id as proid, products.paypal as paypal, products.title as protitle, products.renew_price as price, products.licenseleng as expire');
        if ($GLOBALS['license']['expire'] == 0)
        {
            eval(standard_error(fetch_error('memarea_license_doesnt_expire')));
        }
        $GLOBALS['cart'] = $this->buildCartRow('billing', '', construct_phrase($this->
            vbphrase['memarea_renew_x'], $GLOBALS['license']['protitle']), $GLOBALS['license']['price'],
            $GLOBALS['license']['proid']);
        $GLOBALS['price'] = $GLOBALS['license']['price'];
        $GLOBALS['action'] = 'payment_renewals';
        $GLOBALS['templatename'] = 'memarea_billingdetails';
    }

    function handleRequestpayment_renewals()
    {
        $this->vbulletin->input->clean_array_gpc('p', array('id' => TYPE_INT, 'del_item' =>
            TYPE_ARRAY, 'fullname' => TYPE_STR, 'address_1' => TYPE_STR, 'address_2' =>
            TYPE_STR, 'address_city' => TYPE_STR, 'address_state' => TYPE_STR, 'address_zip' =>
            TYPE_STR, 'country' => TYPE_STR, 'phone' => TYPE_STR, 'company' => TYPE_STR));
        if ($this->checkDetailsFields('renewals', $this->vbphrase['memarea_required_fields']))
        {
            $information = $this->buildInfoArray();
            $license = $this->getLicense($this->vbulletin->GPC['id'], true, true,
                'products.id as proid, products.paypal as paypal, products.title as protitle, products.renew_price as price, products.licenseleng as expire');
            $GLOBALS['paypal'] = $this->getPaypalAddress($license);
            if ($license['expire'] == 0)
            {
                eval(standard_error(fetch_error('memarea_license_doesnt_expire')));
            }
            if ($this->vbulletin->GPC['del_item']["$license[proid]"])
            {
                standard_error(fetch_error('memarea_no_selected'));
            }
            $GLOBALS['itemname'] = construct_phrase($this->vbphrase['memarea_renew_x'], $license['protitle']);
            $GLOBALS['price'] = $license['price'];
            $GLOBALS['cart'] = $this->buildCartRow('payment', 'payment_renewals', $GLOBALS['itemname'],
                $GLOBALS['price']);
            $GLOBALS['ids'] = array($GLOBALS['paypal'], 'renew', $license['id']);
            $GLOBALS['itemnumber'] = $this->insertPurchaseInfo($GLOBALS['ids'], $information);
            $GLOBALS['templatename'] = 'memarea_paymentprocessor';
        }
    }

    function handleRequestproduct()
    {
        $GLOBALS['id'] = $this->vbulletin->input->clean_gpc('g', 'id', TYPE_INT);
        $GLOBALS['product'] = $this->vbulletin->db->query_first("SELECT id,title,description,thumbnail_ext,price,permissions FROM " .
            TABLE_PREFIX . "ma_products WHERE id = '" . $GLOBALS['id'] . "'");
        if (!$this->checkProductPermissions($GLOBALS['product']))
        {
            print_no_permission();
        }
        if (empty($GLOBALS['product']))
        {
            standard_error(fetch_error('memarea_no_selected'));
        }
        $haspro = ($this->addons['pro'] == 'pro');
        $file = DIR . '/images/productthumbs/' . basename('thumbnail_product_' . $GLOBALS['product']['id'] .
            $GLOBALS['product']['thumbnail_ext']);
        $GLOBALS['show']['prodthumb'] = false;
        if (file_exists($file))
        {
            $GLOBALS['filename'] = 'images/productthumbs/' . basename('thumbnail_product_' .
                $GLOBALS['product']['id'] . $GLOBALS['product']['thumbnail_ext']);
            $GLOBALS['show']['prodthumb'] = true;
        }
        $GLOBALS['templatename'] = 'memarea_product';
    }

    function handleRequesteditlicense()
    {
        $id = $this->vbulletin->input->clean_gpc('r', 'id', TYPE_UINT);
        $license = $this->getLicense($id, true, true,
            'products.title as protitle, products.licenseleng as expire', true);
        $GLOBALS['public'] = (intval($license['public']) == 1) ? 'checked="checked"' :
            '';
        $GLOBALS['private'] = (intval($license['public']) == 0) ? 'checked="checked"' :
            '';
        $license['dateline'] = vbdate($this->vbulletin->options['dateformat'], $license['dateline']);
        $GLOBALS['addurls'] = unserialize($license['add_urls']);
        $GLOBALS['license'] = &$license;
        $GLOBALS['templatename'] = 'memarea_editlicense';
    }

    function handleRequestdoeditlicense()
    {
        $this->vbulletin->input->clean_array_gpc('p', array('id' => TYPE_INT, 'siteurl' =>
            TYPE_STR, 'sitetitle' => TYPE_STR, 'description' => TYPE_STR, 'additional' =>
            TYPE_ARRAY, 'public' => TYPE_STR));
        $license = $this->getLicense($this->vbulletin->GPC['id'], true, false);
        $licensedm = datamanager_init('License', $this->vbulletin, ERRTYPE_ARRAY);
        $licensedm->set_existing($license);
        if (!$licensedm->setr('url', $this->vbulletin->GPC['siteurl']))
        {
            eval(standard_error($this->vbphrase['memarea_please_fix_urls']));
        }
        $licensedm->setr('title', $this->vbulletin->GPC['sitetitle']);
        $licensedm->setr('description', $this->vbulletin->GPC['description']);
        $licensedm->setr('add_urls', serialize($this->vbulletin->GPC['additional']));
        $licensedm->setr('public', $this->vbulletin->GPC['public']);
        $licensedm->pre_save();
        if (count($licensedm->errors) > 0)
        {
            eval(standard_error(implode('<br /> - ', $licensedm->errors)));
        }
        else
        {
            $licensedm->save();
        }
        $vbulletin->url = 'members.php?do=editlicense&id=' . $this->vbulletin->GPC['id'];
        eval(print_standard_redirect($error, false, true));
    }
}

?>

You get this message by trying to use an empty value as an object. Line 505 of this file:

$vbulletin->url = 'members.php?' . $vbulletin->session->vars['sessionurl'] . "do=details";

does this, as $vbulletin is not defined anywhere in that function. It’s hard to tell without understanding the code, but it should probably be using $this->vbulletin as that’s the name of a property on the class.

As an aside, this code is hilariously out of date. I’d have a good think about just spending the cash on upgrading, or switching to another free package. You’ll be chasing bugs forever otherwise.

1 Like

That did in fact solve the issue there. I understand this is way outdated, it was written in 2008. I am currently working on upgrading it, but I want it to at least function while I update it. I am not the best with PHP I know I need to replace a lot of the ‘&$’ but I’m not sure of everything that would need to be upgraded. Would you be able to point me in the right direction to updating things?

There have been nine new releases of PHP since 2008. You’re in for a wild ride… I’d start with PHP’s migration documentation and go from version to version, checking for backwards incompatible changes - these will mainly be function deprecations.

Your code is probably written for php 5.2, so you’ll have start with 5.2 to 5.3 and go from there. It won’t help that the code just seems to be crap - that error I pointed out would have been just as much of a problem in 5.2.

1 Like

Thank you so much skawid, I have been attempting to ask on stackoverflow but it is filled with hypocritical douches that cant even point me in the right direction. I will defiantly be going over those docs ( I didn’t even know they were there) as far as my updating progress goes I keep a list of things I’ve learned to change:

Find:
datamanager(
function vB_DataManager
function delete()
=&
 split(
$groupis = $_GET['groupis'];
split
parent::
ereg

Replace
datamanager_init(
function __construct
function delete($doquery = true)
=
 preg_split(
$groupis = intval($_GET['groupis']);
explode
parent::__construct
preg_match

But when you say that the above code is crap, could you provide me an example of why, and a better way to write said function? (just one of the small ones)

There aren’t many discrete “write this like this” bits really, it’s just all a bit janky.

Use of $GLOBALS is usually a bad sign, as it means different parts of your code are having an effect on each other where you might not expect. But it’s not as simple as removing thee references to $GLOBALS; it’s more the fact that the code is put together in such a way that $GLOBALS is required.

Use of eval is also sketchy; it’s used to build code dynamically, which again can have strange consequences as you can’t always see what’s happening.

None of these will stop you doing what you’re trying to do, but they’ll make it more difficult.

1 Like

Those are actually one of the few things I know a little about (when it comes to vBulletin) the globals variable is part of hooking into vBulletin, and the evals are how the templates are spit out, I believe the only way to go about doing anything to update those would require rewriting vBulletin all together. Although there are newer forum software’s and even newer versions of vBulletin, this is my preferred version. As far as updating everything else though I have already begun reading through the documents you pointed me to, and greatly appreciate the time you’ve given me.

Ah, the good old days. :stuck_out_tongue: Best of luck!

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service