vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Call to a member function on a non-object (https://vborg.vbsupport.ru/showthread.php?t=131719)

josiespencer 11-16-2006 03:18 PM

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?

Adrian Schneider 11-16-2006 03:24 PM

The error is actually happening in a plugin, can you check which plugins you have that are using the global_start hook?

josiespencer 11-16-2006 03:33 PM

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

Adrian Schneider 11-16-2006 03:41 PM

Disable one at a time until you figure out which is causing the error, then post the code for it here.

josiespencer 11-16-2006 04:59 PM

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.


All times are GMT. The time now is 04:48 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01101 seconds
  • Memory Usage 1,796KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete