At Dragonsys. Currently there is no undo for the database. I've seen a couple folks that have managed to convert back but at this point I feel it would be easier to get this working.
Oh oh oh.. As I write this I've gotten a working write a new post in an existing thread in php. So its not seeming so bleak. But I need to figure out how to write a new thread. Now that I have figured this out, I'm pretty sure I can get the rest in time. It's not pretty. But it works.
My issue btw was the:
vB5_Autoloader::register(dirname(__FILE__));
dirname(__FILE__) grabs your current working folder so I changed this to be the forums and solved the rest of my issues at least for creating a post.
I've posted this code so that if someone needed something like I did they can use it. Its not cleaned up, as I'm not sure what needs to stay or go yet. But it works, and should get you where you need to go.
Code:
<?PHP
// Attempt for creating thread code
define('VB_ENTRY', 1);
chdir($_SERVER['DOCUMENT_ROOT']."/forum/core");
require_once('./global.php');
require_once('../includes/vb5/autoloader.php');
vB5_Autoloader::register($_SERVER['DOCUMENT_ROOT']."/forum");
$app = vB5_Frontend_Application::init('config.php');
$options = [];
$input = array(
'title' => 'Posting through the API',
'rawtext' => 'Edited more Change text3',
'nodeid' => 1099448,
'parentid' => 85,
'channelid' => 85,
'ret' => '',
'tags' => '',
'reason' => '',
'iconid' => '',
'prefixid' => '',
'hvinput' => '',
'subtype' => '',
'userid' => '1',
'username' => 'User',
'nl2br' => (isset($_POST['nl2br']) ? (bool)$_POST['nl2br'] : false),
);
$api = Api_InterfaceAbstract::instance();
if (!empty($_POST['setfor']))
{
$input['setfor'] = $_POST['setfor'];
}
// get user info for the currently logged in user
$user = $api->callApi('user', 'fetchUserinfo', array());
$time = vB5_Request::get('timeNow');
$tagRet = false;
$textData = array(
'title' => $input['title'],
'parentid' => $input['parentid'],
'prefixid' => $input['prefixid'],
'iconid' => $input['iconid'],
);
if ($input['nodeid']){ //If we're here. We are to edit a post.
$result = array();
if ($user['userid'] < 1){
$result['error'] = 'logged_out_while_editing_post';
echo $result['error'];
exit;
}
$textData['rawtext'] = $input['rawtext'];
$textData['reason'] = $input['reason'];
// $textData += $this->getArticleInput();
$options = array();
// We need to convert WYSIWYG html here and run the img check
if (isset($textData['rawtext'])){
$tmpText = $api->callApi('bbcode', 'convertWysiwygTextToBbcode', array($textData['rawtext'], $options));
// Check Images
if (!$phrase = vB5_Frontend_Controller_Bbcode::verifyImgCheck($tmpText)){
$result['error'] = $phrase;
echo "Result:".$result['error'];
exit;
}
}
if ($input['nl2br'])
{
// not using ckeditor (on edit, 'nl2br' goes in the data array)
$textData['nl2br'] = true;
}
$nodeId = $api->callApi('content_text', 'update', [$input['nodeid'], $textData, $options]);
//update tags
$tags = !empty($input['tags']) ? explode(',', $input['tags']) : array();
$tagRet = $api->callApi('tags', 'updateUserTags', array($input['nodeid'], $tags));
}
else //Here we start a new post/thread
{
$nodeId = $api->callApi('content_text', 'add', [$input, $options]);
}
if ($nodeId == '1'){
echo "updated";
}
if(!is_int($nodeId))
{
echo "Array";
print_r($nodeId);
exit;
}
print 'Node '. $nodeId . ' created successfully';
?>