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($vbulletin, fetch_tag_list());
$vbulletin->options['cybfrules_rules'] = $parser->do_parse($vbulletin->options['cybfrules_rules'],1, 1, 1, 1, 1);
$vbulletin->options['cybfrules_note1'] = $parser->do_parse($vbulletin->options['cybfrules_note1'],1, 1, 1, 1, 1);
$vbulletin->options['cybfrules_note2'] = $parser->do_parse($vbulletin->options['cybfrules_note2'],1, 1, 1, 1, 1);
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.