vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   bbcode processor on external php page (https://vborg.vbsupport.ru/showthread.php?t=299436)

KaitenV 06-23-2013 10:35 PM

bbcode processor on external php page
 
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 Code:

<?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(!
$ForumRunError("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($vbulletinfetch_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;

}

?>

PHP Code:

echo output_news(5,2); 

https://vborg.vbsupport.ru/showthread.php?t=81943
https://vborg.vbsupport.ru/showthrea...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.


All times are GMT. The time now is 01:55 PM.

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.01221 seconds
  • Memory Usage 1,755KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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