KaitenV
06-24-2013, 01:22 PM
I'm looking for an upgrade of vbulletin external for vbulletin 3 to vbulletin 4. I was was running vbulletin 3.7.2, and I am now running 4.2.1. The script worked perfectly, but now it shows the vbulletin forum shut down page. I'm looking for a way to export the vbulletin bbcode parser to an external page so the posts fetched via my query can have their bbcode parsed.
This is the code that now shuts down:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vBExternal');
$phrasegroups = array();
$specialtemplates = array(
'options',
);
$actiontemplates = array();
$globaltemplates = array();
if( !file_exists('./includes/config.php')) {
echo "includes/config.php does not exist. Cannot continue.";
exit;
}
require_once('./includes/class_core.php');
require('./includes/config.php');
DEFINE('DIR','.');
DEFINE('TABLE_PREFIX',$config['Database']['tableprefix']);
$vbulletin =& new vB_Registry();
switch (strtolower($config['Database']['dbtype']))
{
case 'mysql':
case '':
{
$db =& new vB_Database($vbulletin);
break;
}
case 'mysqli':
{
$db =& new vB_Database_MySQLi($vbulletin);
break;
}
default:
{
die('Fatal error: Database class not found');
}
}
require_once('./includes/functions.php');
$db->connect(
$config['Database']['dbname'],
$config['MasterServer']['servername'],
$config['MasterServer']['port'],
$config['MasterServer']['username'],
$config['MasterServer']['password'],
$config['MasterServer']['usepconnect'],
$config['SlaveServer']['servername'],
$config['SlaveServer']['port'],
$config['SlaveServer']['username'],
$config['SlaveServer']['password'],
$config['SlaveServer']['usepconnect'],
$config['Mysqli']['ini_file']
);
$vbulletin->db =& $db;
define('TIMENOW', time());
require_once('./includes/class_bbcode.php');
$Data = "";
/*
$datastore_class = (!empty($config['Misc']['datastore'])) ? $config['Misc']['datastore'] : 'vB_Datastore';
if ($datastore_class != 'vB_Datastore')
{
require_once('./includes/class_datastore.php');
}
$vbulletin->datastore =& new $datastore_class($vbulletin, $db);
$vbulletin->datastore->fetch($specialtemplates);*/
function RunError($message = "") {
echo "<font size='1' face='verdana'>There was an error while processing vBExternal:<br />{$message}</font>";
exit;
}
function output_News($a = 5,$f = ""){
global $db,$vbulletin,$cmsstyle;
$Amount = ($a) ? intval($a) : 5;
$Forum = $f;
if(!$Forum) RunError("No specified forum to pull news from.");
$NewestNews = $db->query("
select t.*,p.pagetext
from ".TABLE_PREFIX."thread t
left join ".TABLE_PREFIX."post p on(p.postid=t.firstpostid)
where t.forumid in($Forum)
order by dateline desc
limit 0,$Amount");
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
while($News = $db->fetch_array($NewestNews)) {
$News['date'] = date( "l M j Y", $News['dateline']);
$News['time'] = vbdate($vbulletin->options['timeformat'], $News['dateline']);
$News['replycount'] = vb_number_format($News['replycount']);
$spt = explode('[read more]',$News['pagetext']);
$News['pagetext'] = &$spt[0];
$News['pagetext'] = $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f);
eval('$Data .= "'.$cmsstyle.'";');
}
$Data = str_replace('images/smilies/',"{$vbulletin->options[bburl]}/images/smilies/",$Data);
return $Data;
}
?>
echo output_news(5,2);
https://vborg.vbsupport.ru/showthread.php?t=81943
https://vborg.vbsupport.ru/showthread.php?t=83005&page=4
Does anyone know of an already existing script to export threads to a php web page and parse the bbcode? I'm looking to export threads as news.
This is the code that now shuts down:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vBExternal');
$phrasegroups = array();
$specialtemplates = array(
'options',
);
$actiontemplates = array();
$globaltemplates = array();
if( !file_exists('./includes/config.php')) {
echo "includes/config.php does not exist. Cannot continue.";
exit;
}
require_once('./includes/class_core.php');
require('./includes/config.php');
DEFINE('DIR','.');
DEFINE('TABLE_PREFIX',$config['Database']['tableprefix']);
$vbulletin =& new vB_Registry();
switch (strtolower($config['Database']['dbtype']))
{
case 'mysql':
case '':
{
$db =& new vB_Database($vbulletin);
break;
}
case 'mysqli':
{
$db =& new vB_Database_MySQLi($vbulletin);
break;
}
default:
{
die('Fatal error: Database class not found');
}
}
require_once('./includes/functions.php');
$db->connect(
$config['Database']['dbname'],
$config['MasterServer']['servername'],
$config['MasterServer']['port'],
$config['MasterServer']['username'],
$config['MasterServer']['password'],
$config['MasterServer']['usepconnect'],
$config['SlaveServer']['servername'],
$config['SlaveServer']['port'],
$config['SlaveServer']['username'],
$config['SlaveServer']['password'],
$config['SlaveServer']['usepconnect'],
$config['Mysqli']['ini_file']
);
$vbulletin->db =& $db;
define('TIMENOW', time());
require_once('./includes/class_bbcode.php');
$Data = "";
/*
$datastore_class = (!empty($config['Misc']['datastore'])) ? $config['Misc']['datastore'] : 'vB_Datastore';
if ($datastore_class != 'vB_Datastore')
{
require_once('./includes/class_datastore.php');
}
$vbulletin->datastore =& new $datastore_class($vbulletin, $db);
$vbulletin->datastore->fetch($specialtemplates);*/
function RunError($message = "") {
echo "<font size='1' face='verdana'>There was an error while processing vBExternal:<br />{$message}</font>";
exit;
}
function output_News($a = 5,$f = ""){
global $db,$vbulletin,$cmsstyle;
$Amount = ($a) ? intval($a) : 5;
$Forum = $f;
if(!$Forum) RunError("No specified forum to pull news from.");
$NewestNews = $db->query("
select t.*,p.pagetext
from ".TABLE_PREFIX."thread t
left join ".TABLE_PREFIX."post p on(p.postid=t.firstpostid)
where t.forumid in($Forum)
order by dateline desc
limit 0,$Amount");
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
while($News = $db->fetch_array($NewestNews)) {
$News['date'] = date( "l M j Y", $News['dateline']);
$News['time'] = vbdate($vbulletin->options['timeformat'], $News['dateline']);
$News['replycount'] = vb_number_format($News['replycount']);
$spt = explode('[read more]',$News['pagetext']);
$News['pagetext'] = &$spt[0];
$News['pagetext'] = $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f);
eval('$Data .= "'.$cmsstyle.'";');
}
$Data = str_replace('images/smilies/',"{$vbulletin->options[bburl]}/images/smilies/",$Data);
return $Data;
}
?>
echo output_news(5,2);
https://vborg.vbsupport.ru/showthread.php?t=81943
https://vborg.vbsupport.ru/showthread.php?t=83005&page=4
Does anyone know of an already existing script to export threads to a php web page and parse the bbcode? I'm looking to export threads as news.