Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 11-16-2006, 03:18 PM
josiespencer josiespencer is offline
 
Join Date: Dec 2005
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Call to a member function on a non-object

PHP Code:
if (!is_demo_mode())
{
    @
ob_start();
    (
$hook vBulletinHook::fetch_hook('global_start')) ? eval($hook) : false;
    
$phpinclude_output = @ob_get_contents();
    @
ob_end_clean();

The $hook evaluation is this piece of code throws an error:

Fatal error: Call to a member function on a non-object in /home/sapsuper/public_html/forums/global.php(356) : eval()'d code on line 125

Why?
Reply With Quote
  #2  
Old 11-16-2006, 03:24 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The error is actually happening in a plugin, can you check which plugins you have that are using the global_start hook?
Reply With Quote
  #3  
Old 11-16-2006, 03:33 PM
josiespencer josiespencer is offline
 
Join Date: Dec 2005
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Sir Adrian.

I would have said that my website wasn't heavily modded, but there are six plugins using the global_start hook:

Cyb - Advanced Forum Rules - BB&Link&Accept
Custom Links
Cyb - Forumhome Sub-Forums Manager 1
Miserable Users
[Component] Invites System
Alternating Row Color for ForumBits Function
Reply With Quote
  #4  
Old 11-16-2006, 03:41 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Disable one at a time until you figure out which is causing the error, then post the code for it here.
Reply With Quote
  #5  
Old 11-16-2006, 04:59 PM
josiespencer josiespencer is offline
 
Join Date: Dec 2005
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It looks like there are two bad ones - Custom Links and Advanced Forum Rules. If you turn either of them "off", there is no problem. But leave either of them "on", and the error occurs. After looking at them a bit, should I change those "$db->"s to "$vbulletin->db->"s?

The code for Advanced Forum Rules is:
PHP Code:
        if ($vbulletin->options['cybfrules_enable'])
        {
            require_once(
DIR '/includes/class_bbcode.php');

            
$parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
            
$vbulletin->options['cybfrules_rules'] = $parser->do_parse($vbulletin->options['cybfrules_rules'],11111);
            
$vbulletin->options['cybfrules_note1'] = $parser->do_parse($vbulletin->options['cybfrules_note1'],11111);
            
$vbulletin->options['cybfrules_note2'] = $parser->do_parse($vbulletin->options['cybfrules_note2'],11111);
            
            if (
$vbulletin->options['cybfrules_show_link'])
            {
            
$cyb_frules_sr1 = ('vbphrase[user_cp]</a></td>');
            
$vbulletin->templatecache['navbar'] = str_replace($cyb_frules_sr1,$cyb_frules_sr1.$vbulletin->templatecache['cyb_frules_link'],$vbulletin->templatecache['navbar']);

            eval(
'$cyb_frules_link = "' fetch_template('cyb_frules_link') . '";');
            }

            if (
$_POST['cfrulesagree'] == '1')
            {
                
$db->query_write(" UPDATE " TABLE_PREFIX "user SET cfrules_read_status = 1 WHERE userid = " $vbulletin->userinfo['userid'] . " ");
                if (!
$vbulletin->userinfo['userid'])
                {
                    
vbsetcookie('cfrrs''1');
                }
                
$vbulletin->url $_COOKIE[COOKIE_PREFIX 'cybbacktolocation'];
                
exec_header_redirect($vbulletin->url);
            }
            
            
$cfrules_check_user $db->query_read(" SELECT cfrules_read_status FROM " TABLE_PREFIX "user AS user WHERE userid = " $vbulletin->userinfo['userid'] . " ");
            while (
$cfrules_force $db->fetch_array($cfrules_check_user))
            {
                
$cfrulesagreed $cfrules_force['cfrules_read_status'];
            }
            if (!
$vbulletin->userinfo['userid'])
            {
                
$cfrulesagreed $_COOKIE[COOKIE_PREFIX 'cfrrs'];
                if (!
$_COOKIE[COOKIE_PREFIX 'cfrrs'])
                {
                
$cfrulesagreed "0";
                }
            }
        } 
The code for Custom Links is:

PHP Code:
    $getdroplinks $db->query_read("SELECT * FROM " TABLE_PREFIX "custom_droplinks WHERE linkid ORDER BY number ASC");

    while(
$dlink $db->fetch_array($getdroplinks))
    {    
       if(
$dlink['new_window'] == 1)
       {
         
$new "_blank";
        }
        else
        {
         
$new "";
        }
        
        if(!empty(
$dlink['image']))
        {
          
$img "<img src='".$dlink['image']."' width='16' height='16' />";
        }
        else
        {
          
$img "";
        }
        
        
$dlink['link_perms'] = explode(","$dlink['link_perms']);

if(
in_array($vbulletin->userinfo['usergroupid'], $dlink['link_perms']) )

    
$custom_droplinks .= "<tr><td class='vbmenu_option'>$img<a href='".$dlink['url']."' target='$new' title='".$dlink['alt']."'>".$dlink['name']."</a></td></tr>";
}                  
        eval(
'$custom_droplinks = "' fetch_template('custom_droplinks') . '";');
    }
    
        
    
$getsinglelinks $db->query_read("SELECT * FROM " TABLE_PREFIX "custom_singlelinks WHERE linkid");
    
        while(
$slink $db->fetch_array($getsinglelinks))
    {    
        if(
$slink['new_window'] == 1)
       {
         
$new "_blank";
        }
        else
        {
         
$new "";
        }
        
        if(!empty(
$slink['image']))
        {
          
$img "<img src='".$slink['image']."' width='16' height='16' />";
        }
        else
        {
          
$img "";
        }
    
      
$slink['link_perms'] = explode(","$slink['link_perms']);

if(
in_array($vbulletin->userinfo['usergroupid'], $slink['link_perms']) )

    
$custom_singlelinks .= "<td class='vbmenu_control'>$img<a href='".$slink['url']."' target='$new' title='".$slink['alt']."'>".$slink['name']."</a></td>";
}                  
        eval(
'$custom_singlelinks = "' fetch_template('custom_singlelinks') . '";');
    }
    
    
$search_text '$vbphrase[calendar]</a></td>';
$vbulletin->templatecache['navbar'] = str_replace($search_text,
$search_text.fetch_template('customlinks1'),$vbulletin->templatecache['navbar']);

$search_text2 '<!-- / NAVBAR POPUP MENUS -->';
$vbulletin->templatecache['navbar'] = str_replace($search_text2,
$search_text2.fetch_template('customlinks2'),$vbulletin->templatecache['navbar']); 
Replacing the $db0> with $vbulletin->db-> seems to have resolved the issue for both plugins - now I just need to see if they still work!

Well, everything seems to work fine after the changes. Except my program which doesn't seem to be doing anything at all - it runs without error but does not change the data in the password column of the forums table:
PHP Code:
<?php

// ######################## Set up PHP Environment ###########################
error_reporting(E_ALL & ~E_NOTICE);
@
set_time_limit(0);

define('CVS_REVISION''$RCSfile: misc.php,v $ - $Revision: 1.220 $');
define('NOZIP'1);

// ########################## Required Includes ############################
require_once('./global.php');
require_once(
DIR '/includes/functions_databuild.php');

// ############################# Rebuild the 757 Forum ###############################
log_admin_action();

$pwdate vbdate('Ymd',TIMENOW);
$vbulletin->db->query_write("UPDATE " .TABLE_PREFIX"forum SET password = 'george{$pwdate}' WHERE forumid = 757");
build_forum_permissions($forum['757']);
vbflush();
unset(
$forum['757'], $vbulletin->forumcache);

?>
Actually, that isn't true - it is working but only partially. I looked in the database itself and the password george20061116 is there. But looking at the forums manager in my vBulletin website the password is still blank. So it looks like the update query is working fine but not the "build_forum_permissions($forum['757']);" statement. I am not sure what to do now.

OK, it works now. You can close this thread.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:12 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06567 seconds
  • Memory Usage 2,272KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete