Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2013, 01:22 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default parse bbcode on external webpage

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.
Reply With Quote
  #2  
Old 06-26-2013, 04:38 PM
KaitenV's Avatar
KaitenV KaitenV is offline
 
Join Date: Apr 2009
Posts: 36
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone please?
Reply With Quote
Reply


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 01:55 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.03447 seconds
  • Memory Usage 2,203KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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_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